virtualenv: can't find '__main__' module
Update:
When I run pip3 uninstall virtualenv
-> leads me StackOverflow Q.No. 41092519. So I moved the *virtualenv
to /home. Then I opened Synaptic Package Manager
and searched for virtualenv
and marked it for complete removal --> Apply
. I also ran sudo apt-get remove virtualenv
& sudo apt-get purge virtualenv
. Lastly I Rebooted
and ran virtualenv --version
it gave me 16.3.0
That freaked me out. A good Samaritan told me to run (head -1 $(which virtualenv) | cut -d! -f2) -c 'import virtualenv; print(virtualenv.__file__)'
. And that opened my eyes, it told me that this "virtualenv"
was the one under Python2.7 just as our friend mentioned in the comments to the question, above. But I had never installed install pip
for python2
(but it was because I ran sudo easy_install virtualenv
).
Solution Begins Here:
# So then I installed pip
and uninstalled virtualenv
using the same.
# Ran pip3 install virtualenv
# Ran python3 -c 'import virtualenv; print(virtualenv.__file__)'
which gave me the path to virtualenv under python3
which was ~/.local/bin
.
# Amended .bashrc
to add export PATH=$HOME/.local/bin:$PATH
That's it. Hope it helps somebody someday...
You can follow the conversation VirtualenvIssue1310@Github
Related videos on Youtube
Jovial Joe Jayarson
Updated on September 18, 2022Comments
-
Jovial Joe Jayarson over 1 year
$ virtualenv --system-site-packages -p python3 ~/PyVEnv Running virtualenv with interpreter /usr/bin/python3/usr/bin/python3: can't find '__main__' module in '/usr/local/lib/python2.7/dist-packages/virtualenv-16.3.0-py2.7.egg/virtualenv.py'
I'm trying to install virtualenv in my friend's laptop which I guessed will be easier because I had done it once successfully on my laptop, but this is persistent!
$ virtualenv --version 16.3.0 $ pip3 --version pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5)
Debian 9.7
Update: With recent pip (on friend's laptop) I installed virtualenv, then I found that it was absurd and that it must be installed with the deb packages, so I did it the apt-get way and then uninstalled the one which is under pip.
I had encountered some issues in OS installation (on friend's laptop). The usb wouldn't boot in UEFI mode (made bootable by PowerISO), but then I tried creating a bootable USB using balenaEtcher, from my Laptop (which has only BIOS) and for no reason it created an EFI partition in the USB. Anyway then, Debian installation went smoothly in UEFI mode (on friend's laptop). Laptop description here
I had updated to Windows 10 and only then I installed Debian.
What am I forgetting?
-
user996142 about 5 yearsYou are trying to create python3 env by running virtualenv installed in "python2.7" Do you have
virtualenv3
orvirtualenv3.5
? You may needpip3 install virtualenv
-
Jovial Joe Jayarson about 5 yearsI removed the virtualenv distro package. Running
pip3 list
I seevirtualenv
against version15.1.0
, uninstalling that withpip3 uninstall virtualenv
leads me here
-