khu
khu

Reputation: 161

Understanding virtual environment behavior

I'm trying to create a virtual environment and install an older version of pandas. I'm working with anaconda and conda create to make the new environment. I've successfully created an environment with base python, installed pandas 0.13.1, but when I activate my environment and check pandas.__version__ it's telling me it imported the pandas version from my regular development environment (anaconda), pandas 0.14.0.

I've included a screenshot of the install process taking place within the environment, env. I've redacted the env name and username as my company is less than thrilled with back-end 3rd party installs...

The little screen section is the version.py from the pandas folder inside the env environment

Even checking where python shows the env is the first interpreter listed:

Screenshot of installation details

Set PYTHONPATH for regular and virtual env: set PYTHONPATH

Trying to use conda for the virtual environment creation as anaconda is tailored to its use instead of virtualenv.

Upvotes: 1

Views: 321

Answers (1)

Wolfgang Ulmer
Wolfgang Ulmer

Reputation: 3468

You should not use PYTHONPATH when using Anaconda. Virtual environments conflict with PYTHONPATH so make sure that you only have Python package directories in your PYTHONPATH which are not managed by Anaconda.

In your case, PYTHONPATH should be C:\UtilityCode;C:\PycharmProjects.

Upvotes: 1

Related Questions