10

I am trying to use pyinstaller to create a single executable to distribute to users without Python installed.

The script is a very simple one and just to test waters I'm using just a few lines of code as "Guinea Pig".

The Hello World program - no imports, converts fine.

My Guinea Pig program, which imports matplotlib.pyplot and plots a list of values, fails.

The issue is known and documented here, although they claim it is fixed, or maybe I can't read correctly. I think the fix should be available in the "dev version" which should be 3.2.1, and I have installed through pip install --upgrade pyinstaller, to no avail.

I keep getting the same syntax error, which occurs when reading the

module jinja2\asyncsupport.py

Any idea how to work around this? My project is ultra simple and it just involves matplotlib, pandas, reading a file and plotting some data.

1 Answer 1

13

I got the same error.

The reason is Jinja2 added new async function for Python3.6 in version 2.9.

Please see http://jinja.pocoo.org/docs/2.9/changelog/#version-2-9-6

There are two ways to avoid this error. Both of these worked for me.

  1. Downgrade jinja2

       # using Anaconda
       conda install jinja2=2.8.1
    
       # using pip
       pip install jinja2==2.8.1
    
  2. Install dev version of PyInstaller

      # install from github
      # Don't run "pip install -U pyinstaller" because the dev version is not released yet
      pip install git+https://github.com/pyinstaller/pyinstaller.git
    
      # check if "PyInstaller (3.3.dev0+g483dfde)" is in the list
      pip list
    
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! Option 1 worked seamlessly. I had tried option 2 already on my own, but I failed as I didn't have git installed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.