Hamid Rouhani
Hamid Rouhani

Reputation: 2459

Cannot install jupyter on windows: No module named '_pyrsistent_version'

I use "Windows x86-64 embeddable zip file" python 3.7.3 distribution in Windows 7 SP1 x64 to run Python. I have added pip script and it's working.

I tried to install jupyter 1.0.0 using pip. This error occurred:

C:\Users\user\Downloads\python-3.7.3-embed-amd64>Scripts\pip.exe install jupyter
Collecting jupyter
  Using cached jupyter-1.0.0-py2.py3-none-any.whl (2.7 kB)
Collecting ipykernel
  Using cached ipykernel-5.1.4-py3-none-any.whl (116 kB)
.
.
[SUMMARIZED]
.
.
Collecting pywinpty>=0.5; os_name == "nt"
  Using cached pywinpty-0.5.7-cp37-cp37m-win_amd64.whl (1.3 MB)
Collecting parso>=0.5.2
  Using cached parso-0.6.1-py2.py3-none-any.whl (97 kB)
Collecting pyrsistent>=0.14.0
  Using cached pyrsistent-0.15.7.tar.gz (107 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\user\downloads\python-3.7.3-embed-amd64\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-mvod9jy8\\pyrsistent\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-mvod9jy8\\pyrsistent\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\user\AppData\Local\Temp\pip-install-mvod9jy8\pyrsistent\pip-egg-info'
         cwd: C:\Users\user\AppData\Local\Temp\pip-install-mvod9jy8\pyrsistent\

    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\user\AppData\Local\Temp\pip-install-mvod9jy8\pyrsistent\setup.py", line 10, in <module>
        from _pyrsistent_version import __version__
    ModuleNotFoundError: No module named '_pyrsistent_version'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Then I tried to install pyrsistent 0.15.7. The same error occurred:

C:\Users\user\Downloads\python-3.7.3-embed-amd64>Scripts\pip.exe install pyrsistent
Collecting pyrsistent
  Using cached pyrsistent-0.15.7.tar.gz (107 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\user\downloads\python-3.7.3-embed-amd64\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-ssyijah2\\pyrsistent\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-ssyijah2\\pyrsistent\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\user\AppData\Local\Temp\pip-install-ssyijah2\pyrsistent\pip-egg-info'
         cwd: C:\Users\user\AppData\Local\Temp\pip-install-ssyijah2\pyrsistent\

    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\user\AppData\Local\Temp\pip-install-ssyijah2\pyrsistent\setup.py", line 10, in <module>
        from _pyrsistent_version import __version__
    ModuleNotFoundError: No module named '_pyrsistent_version'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

How can I install the jupyter and fix this error?

Upvotes: 3

Views: 4147

Answers (2)

Patrik Staron
Patrik Staron

Reputation: 409

Same problem happened to me. My solution:

  1. When you have pip installed,
  2. download pyrsistent 0.15.7
  3. Extract it and copy "_pyrsistent_version.py" to %pythoninstallationdir%/Lib/site-packages (note, %pythoninstallationdir% is just a path to your installation directory, wherever it may be, it may not exactly be the environment variable)
  4. Verify that in the file %pythoninstallationdir%/python38._pth you have "./lib/site-packages" line.
  5. Install jupyter: python -m pip install jupyter
  6. You can now run the notebook using jupyter notebook

Note, that you only 'faked' python to think everything is fine and you installed jupyter, but if you wish to do anything later with your python installation that may actually require the pyrsistent module, you should install it now. In setup.py change line 54 from version=__version__ to version='0.15.7' as noted in the other answer. Installation should now work using for example:

python -m pip install ./pyrsistent-0.15.7

Upvotes: 3

Hamid Rouhani
Hamid Rouhani

Reputation: 2459

  1. Download pyrsistent 0.15.7 source file from Download Files section.
  2. Extract the archive into a folder (C:\Users\user\Downloads\pyrsistent-0.15.7 in this case)
  3. Open setup.py in an text editor. Comment line 10:

    # from _pyrsistent_version import __version__
    

    Then change line 54 from this:

        version=__version__,
    

    To this:

        version='0.15.7',
    
  4. Install pyrsistent from modified source with pip:

    C:\Users\user\Downloads\python-3.7.3-embed-amd64>Scripts\pip.exe install ..\pyrsistent-0.15.7
    Processing c:\users\user\downloads\pyrsistent-0.15.7
    Requirement already satisfied: six in c:\users\user\downloads\python-3.7.3-embed-amd64\lib\site-packages (from pyrsistent==0.15.7) (1.12.0)
    Building wheels for collected packages: pyrsistent
      Building wheel for pyrsistent (setup.py) ... done
      Created wheel for pyrsistent: filename=pyrsistent-0.15.7-cp37-cp37m-win_amd64.whl size=56531 sha256=ae2ae62129ecd2aba69353b2cc335a23cbf53024a1ac211d01c1d792f465f0b0
      Stored in directory: c:\users\user\appdata\local\pip\cache\wheels\ea\5a\2e\b0e3bb620adcd5a9a0d22e143161ab87ee02da6eb86e4b3657
    Successfully built pyrsistent
    Installing collected packages: pyrsistent
    Successfully installed pyrsistent-0.15.7
    
  5. Install jupyter using pip:
    C:\Users\user\Downloads\python-3.7.3-embed-amd64>Scripts\pip.exe install jupyter
    Collecting jupyter
      Using cached jupyter-1.0.0-py2.py3-none-any.whl (2.7 kB)
    Collecting ipykernel
      Using cached ipykernel-5.1.4-py3-none-any.whl (116 kB)
    .
    .
    [SUMMARIZED]
    .
    .
    Successfully installed MarkupSafe-1.1.1 Send2Trash-1.5.0 backcall-0.1.0 bleach-3.1.0 colorama-0.4.3 decorator-4.4.1 defusedxml-0.6.0 entrypoints-0.3 importlib-metadata-1.5.0 ipykernel-5.1.4 ipython-7.12.0 ipython-genutils-0.2.0 ipywidgets-7.5.1 jedi-0.16.0 jinja2-2.11.1 jsonschema-3.2.0 jupyter-1.0.0 jupyter-client-5.3.4 jupyter-console-6.1.0 jupyter-core-4.6.1 mistune-0.8.4 nbconvert-5.6.1 nbformat-5.0.4 notebook-6.0.3 pandocfilters-1.4.2 parso-0.6.1 pickleshare-0.7.5 prometheus-client-0.7.1 prompt-toolkit-3.0.3 pygments-2.5.2 pywin32-227 pywinpty-0.5.7 pyzmq-18.1.1 qtconsole-4.6.0 terminado-0.8.3 testpath-0.4.4 tornado-6.0.3 traitlets-4.3.3 wcwidth-0.1.8 webencodings-0.5.1 widgetsnbextension-3.5.1 zipp-2.2.0
    

Upvotes: 3

Related Questions