Pipenv with Conda? Pipenv with Conda? python python

Pipenv with Conda?


You can setup Pipenv to use Conda's Python executable and site packages directory (ref).

pipenv --python=$(conda run which python) --site-packages

You can check if you are indeed using your Conda environment in Pipenv:

pipenv run python>>> import sys>>> sys.executable, sys.path# <directories under your Conda environment>

With NumPy installed through Conda, but not Pipenv, you can see that Pipenv will still find NumPy.

conda install numpypipenv run python>>> import numpy as np>>> np.__file__# <path under your Conda environment>

When you install NumPy through Pipenv, it will shadow Conda's installation of the the package.

pipenv install numpypipenv run python>>> import numpy as np>>> np.__file__# <path under your Pipenv environment>


You can install pipenv within a conda environment initialized with python 3.

$ conda create -n pipenv-test python=3$ source activate pipenv-test(pipenv-test)$ pipenv install --python=/home/.../miniconda3/envs/pipenv-test/bin/pythonCreating a virtualenv for this project…Using /home/.../miniconda3/envs/pipenv-test/bin/python (3.6.5) to create virtualenv…⠋Already using interpreter /home/.../miniconda3/envs/pipenv-test/bin/pythonUsing base prefix '/home/.../miniconda3/envs/pipenv-test'New python executable in /home/.../.local/share/virtualenvs/wispy-j1ojliDY/bin/pythonInstalling setuptools, pip, wheel...done.Virtualenv location: /home/.../.local/share/virtualenvs/wispy-j1ojliDYCreating a Pipfile for this project…Pipfile.lock not found, creating…Locking [dev-packages] dependencies…Locking [packages] dependencies…Updated Pipfile.lock (ca72e7)!Installing dependencies from Pipfile.lock (ca72e7)…  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/000:00:00To activate this project's virtualenv, run the following: $ pipenv shell

This seems to work for me but I haven't tested it extensively. Also, my base conda python is 3.6 and I'm using Ubuntu 16.04. I'm curious to hear whether this still gives you trouble.