Broken with Python 3 and Ubuntu 18.04
See original GitHub issueThis is probably not a bug of Pipenv per se (virtualenv -p python3 had a similar issue), however opening just in case this helps someone.
Running the latest version of Python 3 and Ubuntu 18.04, I was getting the following error:
pipenv --python 3
Creating a virtualenv for this project...
Pipfile: /home/licensing/cimtas_certificate_requests/Pipfile
Using /usr/bin/python3 (3.6.5) to create virtualenv...
⠋Running virtualenv with interpreter /usr/bin/python3
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 25, in <module>
import distutils.spawn
ModuleNotFoundError: No module named 'distutils.spawn'
Error while trying to remove the /home/licensing/.local/share/virtualenvs/cimtas_certificate_requests-U5jN4dWL env:
No such file or directory
Virtualenv location:
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python2.7/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/pipenv/vendor/click/core.py", line 1043, in invoke
return Command.invoke(self, ctx)
File "/usr/local/lib/python2.7/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pipenv/cli.py", line 294, in cli
three=three, python=python, warn=True, site_packages=site_packages, pypi_mirror=pypi_mirror
File "/usr/local/lib/python2.7/dist-packages/pipenv/core.py", line 614, in ensure_project
path_to_python = which('python') or which('py')
File "/usr/local/lib/python2.7/dist-packages/pipenv/core.py", line 115, in which
p = os.path.join(location, 'bin', command)
File "/usr/lib/python2.7/posixpath.py", line 70, in join
elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
For virtualenv - python3, I was getting the following, which helped me get to the bottom of the issue:
virtualenv -p python3 .venv
Running virtualenv with interpreter /usr/bin/python3
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 25, in <module>
import distutils.spawn
ModuleNotFoundError: No module named 'distutils.spawn'
Installing python3-distutils
solved the issue.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:27
- Comments:12 (3 by maintainers)
Top Results From Across the Web
reinstall broken python3 in ubuntu 18.4 - Stack Overflow
The solution command is: sudo apt --fix-broken install.
Read more >Broken python dependencies after trying to re-install
I'm not really an experienced linux user, so I'm quite stuck here. Does someone have an idea how I can fix my python...
Read more >Your python3 install is corrupted. Please fix the '/usr/bin ...
When trying to do “do-release-upgrade” from current Ubuntu 18.04 to new 19.04 I am getting error "Your python3 install is corrupted.
Read more >Managing Multiple Versions of Python on Ubuntu 18.04
Easily install and manage multiple versions of Python on Ubuntu 18.04 or older. ... Python via Ubuntu's package manager with apt-get install python3....
Read more >How to fix broken apt-get in Ubuntu? - python
update-cnf-db is a Python 3 script, so your Python 3 setup might be broken as well. ... The same error occurred in ubuntu...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I run into the same issue. My os version is Ubuntu 18.04 When I tried to use
I got the same error. I use
to solve this problem
Actually it is not virtualenv either, it is Ubuntu. Their built-in Python is broken: https://bugs.launchpad.net/ubuntu/+source/apt-btrfs-snapshot/+bug/1763923
As a general rule: Don’t pip-install things to the system Python, almost ever. The system distribution sometimes introduces bugs we cannot anticipate, and cause unnecessary troubles.