happycampr
happycampr

Reputation: 59

Updating a package in a virtual environment with conda

I am trying to update the package flopy, within a virtual environment called flopyenv using the Anaconda Prompt command line. First, I activate the virtual environment using conda activate flopyenv. Then to update flopy, I've tried conda update flopy. I get the following error:

PackageNotInstalledError: Package is not installed in prefix.
  prefix: C:\Users\person\Anaconda3\envs\flopyenv
  package name: flopy

which makes sense since the flopy directory was installed in a different directory (C:\Users\person\Anaconda3\envs\flopyenv\lib\site-packages\flopy). Also, I have checked using conda list and flopy is listed in the environment. How do I point conda update to the proper directory to update flopy within the virtual environment?

Edit: Per merv's comment I've included the output below.

(flopyenv) C:\Users\person>conda list -n flopyenv flopy
# packages in environment at C:\Users\person\Anaconda3\envs\flopyenv:
#
# Name                    Version                   Build  Channel
flopy                     3.3.1                    pypi_0    pypi

Looks like I used pip to install flopy not conda which I guess is why the directories weren't lining up when I tried updating using conda. I was able to successfully update the flopy package using pip.

Upvotes: 3

Views: 1062

Answers (1)

merv
merv

Reputation: 77080

Seems like OP figured it out, but it may be worth mentioning that in addition to using pip to update, it might also work to enable the pip_interop_enabled configuration option. I would only do this on a per-environment basis:

conda activate flopyenv
conda config --env --set pip_interop_enabled true
conda update flopy

However, this is still (as of Conda v 4.9) considered an experimental feature, AFAIK.

Upvotes: 2

Related Questions