2

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.

happycampr
  • 49
  • 1
  • 8
  • I believe you need to update your base environment first. Can you switch to `conda activate base`, update conda, and switch back to do the same thing? – zerecees Feb 13 '21 at 01:22
  • @zerecees I still get the same error with a different directory listed: `PackageNotInstalledError: Package is not installed in prefix. prefix: C:\Users\happy\Anaconda3 package name: flopy` – happycampr Feb 13 '21 at 01:31
  • When did you install conda? Today? – zerecees Feb 13 '21 at 01:34
  • No, not recently, maybe a year and a half ago? – happycampr Feb 13 '21 at 01:36
  • Ah ok. There has been some updates with conda and all since then (which you very well may have on your machine). With what you’re having, I would uninstall and reinstall for a clean slate. So long as it won’t cause you issues. For what it’s worth, I did look into it as best I could, but couldn’t find much else than what I posted above. Sorry :/ – zerecees Feb 13 '21 at 01:40
  • @zerecees on what basis are you recommending reinstalling? I see no reason why this would be the case. – merv Feb 15 '21 at 03:06
  • 1
    @happycampr Please add the output of `conda list -n flopyenv flopy` to the question. Is it possible you installed `flopy` from PyPI instead of Conda? – merv Feb 15 '21 at 03:08
  • 1
    @zerecees thank you for your help, I had thought about uninstalling and reinstalling, but turns out merv was right; I used PyPI instead of conda to originally install the package. – happycampr Feb 15 '21 at 16:19

1 Answers1

1

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.

merv
  • 67,214
  • 13
  • 180
  • 245