pip: pip 18.0 install fails with AttributeError: 'NoneType' object has no attribute 'bytes'
Environment
- pip version: 10.0.1 -> 18.0
- Python version: 3.7 (Windows x64)
- OS: Windows 10
Description pip installs with a compile at runtime bug.
Expected behavior pip installs without error.
How to Reproduce
- Download python 3.7 for windows x64. https://www.python.org/ftp/python/3.7.1/python-3.7.1rc1-amd64.exe
- Install the package
- Install PyCharm 2018.02
- Create a new PyCharm project with virtualenv.
- Create a new terminal and update pip
Output You are using pip version 10.0.1, however version 18.0 is available. You should consider upgrading via the ‘python -m pip install --upgrade pip’ command.
(venv) C:\projects\nltk-tutorial>python -m pip install --upgrade pip Collecting pip Downloading https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl (1.3MB) 100% |████████████████████████████████| 1.3MB 5.8MB/s Installing collected packages: pip Found existing installation: pip 10.0.1 Uninstalling pip-10.0.1: Successfully uninstalled pip-10.0.1 Rolling back uninstall of pip Exception: Traceback (most recent call last): File “C:\projects\nltk-tutorial\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip_internal\basecommand.py”, line 228, in main status = self.run(options, args) File “C:\projects\nltk-tutorial\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip_internal\commands\install.py”, line 335, in run use_user_site=options.use_user_site, File “C:\projects\nltk-tutorial\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip_internal\req_init_.py”, line 49, in install_given_reqs **kwargs File “C:\projects\nltk-tutorial\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip_internal\req\req_install.py”, line 748, in install use_user_site=use_user_site, pycompile=pycompile, File “C:\projects\nltk-tutorial\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip_internal\req\req_install.py”, line 961, in move_wheel_files warn_script_location=warn_script_location, File “C:\projects\nltk-tutorial\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip_internal\wheel.py”, line 431, in move_wheel_files generated.extend(maker.make(spec)) File “C:\projects\nltk-tutorial\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip_vendor\distlib\scripts.py”, line 403, in make self._make_script(entry, filenames, options=options) File “C:\projects\nltk-tutorial\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip_vendor\distlib\scripts.py”, line 307, in _make_script self._write_script(scriptnames, shebang, script, filenames, ext) File “C:\projects\nltk-tutorial\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip_vendor\distlib\scripts.py”, line 243, in _write_script launcher = self._get_launcher(‘t’) File “C:\projects\nltk-tutorial\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip_vendor\distlib\scripts.py”, line 382, in _get_launcher result = finder(distlib_package).find(name).bytes AttributeError: ‘NoneType’ object has no attribute ‘bytes’
(venv) C:\projects\nltk-tutorial>python -m pip install --upgrade pip Requirement already up-to-date: pip in c:\projects\nltk-tutorial\venv\lib\site-packages (18.0)
(venv) C:\projects\nltk-tutorial>pip install ERROR: You must give at least one requirement to install (see “pip help install”) You are using pip version 10.0.1, however version 18.0 is available. You should consider upgrading via the ‘python -m pip install --upgrade pip’ command.
Paste the output of the steps above, including the commands themselves and
pip's output/traceback etc.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 13
- Comments: 31 (4 by maintainers)
try:
python -m pip install -U --force-reinstall pip
inside your venv@fingerman Thanks
works
@fingerman Thanks. That worked instantly.
python -m pip install -U --force-reinstall pip
PyCharm installs pip as an egg (see
C:\projects\nltk-tutorial\venv\lib\site-packages\pip-10.0.1-py3.7.egg
in the traceback above) and egg installations are not supported by pip (we can’t upgrade egg-layout installs).You need to raise this with JetBrains, or create your environments manually. I believe there’s an existing issue about this on the PyCharm tracker (I raised one a couple of years ago, but haven’t heard anything about it since - I stopped tracking it when I gave up using PyCharm because this issue was too much of a problem for me).
easy_install -U pip
worked for me. Was having the issue for 19.0.1You might need the easy install, as it worked for me when upgrading my Pip easy_install -U pip Check this https://stackoverflow.com/questions/52460484/python-3-5-pip-9-attributeerror-nonetype-object-has-no-attribute-bytes
easy_install -U pip The command above is good!
ok, I just encounter the same issue but I have some basic info about this,
the old pip is actually inside my
--user
, soC:\Python37\python.exe -m pip install --user --force-reinstall -U pip
works in my case if I didn’t instruct with--user
the failure will occurmanual remove old version of pip in my user install directory also works,
I had the same but MichealAbaho from the above comment with the
easy_install -U pip
command fixed the issue for me.“python -m pip install -U --force-reinstall pip” didn’t work but “easy_install -U pip” does the trick for me. Thanks a lot.
Same for me.
python -m pip install -U --force-reinstall pip
didn’t fix the problem whereeasy_install -U pip
did. Also on 19.0.1.@fingerman having the same issue on pip 19.0.1, any other fix? Thanks
@fingerman having same error for force install. Please help.
easy_install -U pip
worked for me. thank you!@sapien47 https://github.com/pypa/pip/issues/5820#issuecomment-473693608
This shows where python is looking for python files. It can be useful when you try to troubleshoot python import errors
Nothing worked for me, I eventually installed a coexisting version of Python (3.7), and pip could be upgrdaed for that version.
I am having a similar problem (at least, the traceback is similar). I am using a fresh conda environment (most packages from conda-forge), pip 18.1, python 3.6, and linux. The force-reinstall command given does not solve my issue. I am utilizing the new PEP508 syntax for installing private packages from our internal gitlab server (anonymized below). I added some print statements that I hope will be helpful: