I am currently trying to create a new virtualenvironment using pyenv
, I have various versions of python installed using pyenv
from 3.7.x to 3.9.x.
For creating an environment, I am doing the following:
$pyenv virtualenv 3.8.7 practice_django
which creates the environment and outputs it:
Looking in links: /var/folders/w1/dw5vm6p955bgmws4x53sjlym0000gn/T/tmpwltofgj8
Requirement already satisfied: setuptools in /Users/apple/.pyenv/versions/3.8.7/envs/practice_rasa/lib/python3.8/site-packages (49.2.1)
Requirement already satisfied: pip in /Users/apple/.pyenv/versions/3.8.7/envs/practice_django/lib/python3.8/site-packages (20.2.3)
then I activate the environment using:
$pyenv activate practice_django
And check that the virtualenvironment has been created successfully and is proper by:
$pyenv which python
/Users/apple/.pyenv/versions/practice_django/bin/python
$python -V
Python 3.8.7 # my global python is 3.7.5
$pip -V
pip 20.2.3 from /Users/apple/.pyenv/versions/3.8.7/envs/practice_django/lib/python3.8/site-packages/pip (python 3.8)
So, I know the environment should have been created correctly and is activated.
Now, when I do a pip list
, I get the following (without installing any packages):
Package Version
----------------------- ------------
absl-py 0.12.0
aio-pika 6.8.0
aiofiles 0.7.0
aiormq 3.3.1
alembic 1.4.3
APScheduler 3.7.0
astunparse 1.6.3
async-generator 1.10
async-timeout 3.0.1
attrs 19.3.0
bidict 0.21.2
boto3 1.17.78
botocore 1.20.78
cachetools 4.2.2
certifi 2020.12.5
cffi 1.14.5
cloudpickle 1.6.0
colorclass 2.2.0
coloredlogs 15.0
colorhash 1.0.3
croniter 1.0.13
cryptography 3.4.7
cycler 0.10.0
dm-tree 0.1.6
dnspython 1.16.0
docopt 0.6.2
fbmessenger 6.0.0
future 0.18.2
gast 0.3.3
gitdb 4.0.7
GitPython 3.1.17
google-auth 1.30.0
google-auth-oauthlib 0.4.4
google-pasta 0.2.0
greenlet 1.1.0
grpcio 1.38.0
h11 0.9.0
h5py 2.10.0
httpcore 0.11.1
httplib2 0.19.1
httptools 0.2.0
httpx 0.15.4
humanfriendly 9.1
idna 2.10
isodate 0.6.0
jmespath 0.10.0
joblib 0.15.1
jsonpickle 2.0.0
jsonschema 3.2.0
kafka-python 1.4.7
Keras-Preprocessing 1.1.2
kiwisolver 1.3.1
Mako 1.1.4
Markdown 3.3.4
MarkupSafe 2.0.1
matplotlib 3.3.4
mattermostwrapper 2.2
networkx 2.5.1
numpy 1.18.5
oauth2client 4.1.3
oauthlib 3.1.0
opt-einsum 3.3.0
packaging 20.9
pamqp 2.3.0
pika 1.2.0
Pillow 8.2.0
pip 20.2.3
prompt-toolkit 2.0.10
protobuf 3.17.0
psycopg2-binary 2.8.6
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycparser 2.20
pydot 1.4.2
pykwalify 1.8.0
pymongo 3.10.1
pyparsing 2.4.7
pyrsistent 0.17.3
pyTelegramBotAPI 3.7.9
python-crfsuite 0.9.7
python-dateutil 2.8.1
python-editor 1.0.4
python-engineio 4.2.0
python-socketio 5.3.0
pytz 2021.1
PyYAML 5.4.1
rasa 2.6.2
rasa-sdk 2.6.0
rasa-x 0.39.3
redis 3.5.3
regex 2020.9.27
requests 2.25.1
requests-oauthlib 1.3.0
requests-toolbelt 0.9.1
rfc3986 1.5.0
rocketchat-API 1.15.0
rsa 4.7.2
ruamel.yaml 0.16.13
ruamel.yaml.clib 0.2.2
s3transfer 0.4.2
Sanic-Cors 0.10.0.post3
Sanic-Plugins-Framework 0.9.5
scikit-learn 0.24.2
scipy 1.6.3
sentry-sdk 0.19.5
setuptools 49.2.1
six 1.16.0
sklearn-crfsuite 0.3.6
slackclient 2.9.3
smmap 4.0.0
sniffio 1.2.0
SQLAlchemy 1.3.22
tabulate 0.8.9
tensorboard 2.5.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.0
tensorflow 2.3.2
tensorflow-addons 0.12.0
tensorflow-estimator 2.3.0
tensorflow-hub 0.10.0
tensorflow-probability 0.11.1
tensorflow-text 2.3.0
termcolor 1.1.0
terminaltables 3.1.0
threadpoolctl 2.1.0
tqdm 4.59.0
twilio 6.50.1
typeguard 2.12.0
typing-extensions 3.10.0.0
tzlocal 2.1
ujson 1.35
urllib3 1.26.4
uvloop 0.14.0
wcwidth 0.2.5
webexteamssdk 1.6
websockets 8.1
Werkzeug 2.0.1
wheel 0.36.2
wrapt 1.12.1
yarl 1.6.3
WARNING: You are using pip version 20.2.3; however, version 21.1.2 is available.
You should consider upgrading via the '/Users/apple/.pyenv/versions/3.8.7/envs/practice_django/bin/python3.8 -m pip install --upgrade pip' command.
And when I try to do an uninstall, this happens:
$pip uninstall tensorflow
Found existing installation: tensorflow 2.3.2
Not uninstalling tensorflow at /Users/apple/.pyenv/versions/3.8.7/envs/practice_rasa/lib/python3.8/site-packages, outside environment /Users/apple/.pyenv/versions/3.8.7/envs/practice_django
Can't uninstall 'tensorflow'. No files were found to uninstall.
Which suggests, that my virtualenv practice_django
, might be using packages from another virtualenv practice_rasa
.
Now, if I try to import tensorflow
, I can import it.
I want to create a clean virtualenv, with no packages installed – started to get this error today.
P.S : Even if I create an environment with a different python version say 3.7.9, I get the same error. I have also tried upgrading pip version – which doesn’t help.
For python3.7.9 based virtualenv, I get a similar thing on a pip uninstall
Found existing installation: websockets 8.1
Not uninstalling websockets at /Users/apple/.pyenv/versions/3.8.7/envs/practice_rasa/lib/python3.8/site-packages, outside environment /Users/apple/.pyenv/versions/3.7.9/envs/practice_django
Can't uninstall 'websockets'. No files were found to uninstall.
The package websockets seems to be at the virtual environment practice_rasa, which has python version 3.8.7.
2
Answers
I have been experiencing the same issue. It seems to me like environment isolation is broken.
In my experience, you might be using conda and pyenv at the same time. You may want to remove any conda configs statements from your ~/.bash_profile or ~/.zshrc files.