poetry: poetry env use python3.7 gives error No module named 'virtualenv.seed.via_app_data'
Hi,
I found issue on poetry 1.0.10 when I run poetry env use python3.7
as follows:
Traceback (most recent call last): File “<stdin>”, line 1, in <module> NameError: name ‘PosixPath’ is not defined
So I tried to upgrade to poetry preview version by:
poetry self update --preview ∞ Updating to 1.1.0b4
- Downloading poetry-1.1.0b4-darwin.tar.gz 100%
Then I tried to execute poetry env use python3.7
, now I am getting a different error:
ModuleNotFoundError
No module named ‘virtualenv.seed.via_app_data’
at <frozen importlib._bootstrap>:973 in _find_and_load_unlocked
- OS version and name: MacOS Mojave
- Poetry version: 1.1.0b4
Any help is really appreciated. Please let me know if anymore information is needed.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 11
- Comments: 34 (6 by maintainers)
Well no, I finally found out: when installing via pip after having deleted
/usr/local/bin/virtualenv
, it just kept using the wrong libraries. What I had to do wassudo apt remove --purge python3-virtualenv virtualenv
, and then installvirtualenv
viapip3
.I did not actually installed these packages myself, they were installed as dependencies of
tox
and nothing else. So actually what I did was to removetox
from theapt
installed packages list, and didsudo pip3 install tox tox-pyenv
.So, @demangejeremy I don’t know how it is with your MacOS / Anaconda platform, but it would be an incredible coincidence to get exactly the same problem at the same time but from a totally different cause. I’d suggest you to not give up and hunt for packages like
python3-virtualenv
andvirtualenv
(maybe the names on MacOS differ from the ones on Ubuntu) that would have been installed by your package manager (maybe as dependencies), remove them and replace them bypip3
installed ones.I can confirm that deleting virtualenv installed via apt on
Ubuntu 20.04.1 LTS
by doingsudo apt remove --purge python3-virtualenv virtualenv
and then installing virtualenv via pip by doingpip install -U virtualenv
results in thevirtualenv.seed.via_app_data
error disappearing andpoetry install
behaving normally.pip install -U virtualenv
works@zoopp Please try this steps.
If you installed virtualenv with a package manager something different than PIP (like brew,apt,yum, etc.)
had the same issue on ubuntu 20.04 LTS via wsl2, I also have a few package managers that I use so I wondered if that caused an issue, but I had the same issue in docker.
$ sudo apt remove --purge python3-virtualenv
did the trick, cheers my man!@ycd Your suggestion fixes the issue in my case, thank you! I see I should have read the previous comments more carefully. 😅
I didn’t have a global version of
virtualenv
installed. However, a fresh install of it worked:pip install --force-reinstall virtualenv
I also had this issue, or a variant of it.
Installed poetry
Used
poetry lock
for one app and everything worked fineUsed
poetry lock
for a second app and received the following error message:Followed the most simple suggestion:
$ sudo apt remove --purge python3-virtualenv
Re-ran
poetry-lock
Everything works great, that’s it! :👍:
OS: Ubuntu 20.04.1 LTS x86_64
I was experiencing this with 3.6 in pyenv, on Ubuntu 18.04 in WSL, and upgrading
virtualenv
worked for me.For some reason, it was enough to just uninstall
python3-virtualenv
using system package manager and the error disappeared (I’m on Ubuntu).Like @abn mentioned(In that issue you can see my comment from Jul 15) it’s a problem with virtualenv more specifically if you have two virtualenv installed (In my case i installed one with APT, and one with PIP) that’s causing the error.
@FelixKJose looks like your original issue is an upstream issue with
virtualenv
, see https://github.com/pypa/virtualenv/issues/1873I’m on an arch-based system, I had to do the opposite of what was suggested above.
For me, I had to install python-poetry and python-virtualenv through pacman and uninstall the poetry I installed via the shell script and/or pip.
I experience this issue with Python 3.8.5 as well (when running
poetry install
). I’ll attach the stack trace in case it’s relevant:I’ve been iterating stable release versions backwards starting from v1.1.2 and the latest one in which this doesn’t happen is 1.0.10.
@FelixKJose can you run that with
-vvv
and provide the stack trace please?@mbelang the loop could when the project was locked using
1.1
and you are attempting to install the project using1.0
.