0

I have a conda environment, cenv. While activated, I've installed pipenv via:

(cenv) % conda install -c conda-forge pipenv

I created a pipenv env in a repo by installing a package I'll need, in this case the GDAL bindings, gdal:

(cenv) % pipenv install gdal

All good so far. Now when I want to launch the pipenv shell to see if my installation worked in python, I run:

(cenv) % pipenv shell

And I get:

Launching subshell in virtual environment…
 . /home/<user>/.venvs/cenv-<scramble>/bin/activate
(base) %  . /home/<user>/.venvs/cenv-<scramble>/bin/activate
(modis_lst) (base) % 

So I get kicked out of the (cenv) conda env and put in the system conda env, (base), which is not set up how I need. I can deactivate the (base) env, and activate the (cenv) env, but I'm looking for a better solution. Because I'm not sure I could use pipenv run in this way.

How can I start a pipenv shell or run pipenv while choosing the conda env I want to use? Thanks :)

AMC
  • 2,642
  • 7
  • 13
  • 35
Kyle
  • 83
  • 9

2 Answers2

4

Looks like this related question/answer solves my problem. Needed to run conda config --set auto_activate_base false to disable - you guessed it - auto-activation of the (base) env. Now I can run pipenv shell/pipenv run and the pipenv env will launch within the currently activated conda env.

Kyle
  • 83
  • 9
0

Do you need to create new virtual env in conda using pipenv? If it true, you no need to use pipenv. In anaconda navigator, choose Environment tab, create a new one. Done. If not, please explain, I want to know a new thing.

ngo huy
  • 26
  • 6
  • I have a scenario where I want to use `pipenv` in the typical way with other tools in the particular `conda` env. I'm just using `pipenv` for sake of consistency with other projects, on a system I don't normally use. This is a case where just the `conda` env should be fine by itself, you're right. I found a related question that solves this problem, included the link as an answer if you're interested. – Kyle Jun 08 '20 at 18:46