Force pipenv to create a new virtualenv
I installed pip by downloading virtualenv
, and creating a bootstrap virtualenv, as described in this answer.
Now I want to try out pipenv
, so I used my bootstrap virtualenv to create a new virtualenv and then ran pip install pipenv
. Now I can use pipenv
, but it sees that it's already running in a virtualenv and doesn't create a new one.
How can I get pipenv
to create a new virtualenv so I can have separate virtualenvs for each project? I tried pipenv install -h
, but none of the options look promising.
python pip virtualenv pipenv
add a comment |
I installed pip by downloading virtualenv
, and creating a bootstrap virtualenv, as described in this answer.
Now I want to try out pipenv
, so I used my bootstrap virtualenv to create a new virtualenv and then ran pip install pipenv
. Now I can use pipenv
, but it sees that it's already running in a virtualenv and doesn't create a new one.
How can I get pipenv
to create a new virtualenv so I can have separate virtualenvs for each project? I tried pipenv install -h
, but none of the options look promising.
python pip virtualenv pipenv
To separate environments, you just need to runpipenv
in other project's directory. Be sure to deactivate your current virtualenv first.
– Sraw
Feb 8 '18 at 8:26
To clarify, @Sraw,pipenv
is only installed in a virtualenv. I don't want to install it in my system Python. I can't deactivate my current virtualenv, because that's wherepipenv
is installed.
– Don Kirkby
Feb 8 '18 at 19:35
add a comment |
I installed pip by downloading virtualenv
, and creating a bootstrap virtualenv, as described in this answer.
Now I want to try out pipenv
, so I used my bootstrap virtualenv to create a new virtualenv and then ran pip install pipenv
. Now I can use pipenv
, but it sees that it's already running in a virtualenv and doesn't create a new one.
How can I get pipenv
to create a new virtualenv so I can have separate virtualenvs for each project? I tried pipenv install -h
, but none of the options look promising.
python pip virtualenv pipenv
I installed pip by downloading virtualenv
, and creating a bootstrap virtualenv, as described in this answer.
Now I want to try out pipenv
, so I used my bootstrap virtualenv to create a new virtualenv and then ran pip install pipenv
. Now I can use pipenv
, but it sees that it's already running in a virtualenv and doesn't create a new one.
How can I get pipenv
to create a new virtualenv so I can have separate virtualenvs for each project? I tried pipenv install -h
, but none of the options look promising.
python pip virtualenv pipenv
python pip virtualenv pipenv
asked Feb 8 '18 at 7:37
Don KirkbyDon Kirkby
27.6k10129206
27.6k10129206
To separate environments, you just need to runpipenv
in other project's directory. Be sure to deactivate your current virtualenv first.
– Sraw
Feb 8 '18 at 8:26
To clarify, @Sraw,pipenv
is only installed in a virtualenv. I don't want to install it in my system Python. I can't deactivate my current virtualenv, because that's wherepipenv
is installed.
– Don Kirkby
Feb 8 '18 at 19:35
add a comment |
To separate environments, you just need to runpipenv
in other project's directory. Be sure to deactivate your current virtualenv first.
– Sraw
Feb 8 '18 at 8:26
To clarify, @Sraw,pipenv
is only installed in a virtualenv. I don't want to install it in my system Python. I can't deactivate my current virtualenv, because that's wherepipenv
is installed.
– Don Kirkby
Feb 8 '18 at 19:35
To separate environments, you just need to run
pipenv
in other project's directory. Be sure to deactivate your current virtualenv first.– Sraw
Feb 8 '18 at 8:26
To separate environments, you just need to run
pipenv
in other project's directory. Be sure to deactivate your current virtualenv first.– Sraw
Feb 8 '18 at 8:26
To clarify, @Sraw,
pipenv
is only installed in a virtualenv. I don't want to install it in my system Python. I can't deactivate my current virtualenv, because that's where pipenv
is installed.– Don Kirkby
Feb 8 '18 at 19:35
To clarify, @Sraw,
pipenv
is only installed in a virtualenv. I don't want to install it in my system Python. I can't deactivate my current virtualenv, because that's where pipenv
is installed.– Don Kirkby
Feb 8 '18 at 19:35
add a comment |
3 Answers
3
active
oldest
votes
The current documentation makes it sound like you can set the environment variable PIPENV_IGNORE_VIRTUALENVS
to avoid reusing an already activated virtualenv:
source ~/some/virtualenv/location/bin/activate
PIPENV_IGNORE_VIRTUALENVS=1 pipenv install
I have to admit that I haven't tried this, though.
add a comment |
If you're in a new project directory, these commands create a new virtualenv using pipenv:
Create a new virtualenv with python 2:
pipenv --two
Create a new virtualenv with python 3:
pipenv --three
Create a new virtualenv with an arbitrary python version:
pipenv --python 3.6.4
That doesn't work for me. I think it's because I've installedpipenv
in a virtualenv. It says it's reusing that virtualenv instead of creating a new one. My question is whether I can tell it to create a new one anyway.
– Don Kirkby
Feb 11 '18 at 4:37
I see what you’re getting at. If you’d like to keep your installation of pipenv separate from system dependencies, but use it to create new virtualenvs, you might try using the fancy installation method in the docs. docs.pipenv.org/install/#fancy-installation-of-pipenv. The suggestion is to install pipenv with pipsi, which puts it into an isolated virtualenv but makes it available as a command globally.
– philngo
Feb 11 '18 at 6:45
Another option you could use ispipenv install <package> --system
, which would tell pipenv to use the current virtualenv (still not creating a separate one), but that would likely require installing pipenv into each new project virtualenv you create. It would, however, let you keep separated virtualenvs for each project. Maybe a trade-off you're willing to make.
– philngo
Feb 11 '18 at 6:59
add a comment |
It looks like pipenv has gotten smarter about this situation. Here's what worked for me. First, I installed a bootstrap environment following virtualenv's installation documentation to use it locally from source. That way, I don't need to touch the system Python, and I can install pipenv in the bootstrap environment:
$ curl --location --output virtualenv.tar.gz https://github.com/pypa/virtualenv/tarball/16.1.0
$ tar -xzf virtualenv.tar.gz
$ python pypa-virtualenv-4ad2742/src/virtualenv.py vbootstrap
$ rm -r virtualenv.tar.gz pypa-virtualenv-4ad2742/
$ vbootstrap/bin/pip install pipenv
Then I created a new project folder, and used pipenv to install numpy:
$ mkdir my_project
$ cd my_project
$ ../vbootstrap/bin/pipenv install numpy
Creating a virtualenv for this project...
Pipfile: /home/vagrant/my_project/Pipfile
Using /home/vagrant/vbootstrap/bin/python (2.7.15rc1) to create virtualenv...
✔ Complete
Already using interpreter /home/vagrant/vbootstrap/bin/python
Using real prefix '/usr'
New python executable in /home/vagrant/.local/share/virtualenvs/my_project-KmT425B_/bin/python
Installing setuptools, pip, wheel...
done.
Virtualenv location: /home/vagrant/.local/share/virtualenvs/my_project-KmT425B_
Creating a Pipfile for this project...
Installing numpy...
Adding numpy to Pipfile's [packages]...
✔ Installation Succeeded
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
✔ Success!
Updated Pipfile.lock (57a39c)!
Installing dependencies from Pipfile.lock (57a39c)...
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 1/1 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
To make it easier to use, I created a symbolic link:
$ ln -s ~/vbootstrap/bin/pipenv ~/pipenv
$ ~/pipenv shell
Launching subshell in virtual environment...
vagrant@vagrant:~/my_project$ . /home/vagrant/.local/share/virtualenvs/my_project-KmT425B_/bin/activate
(my_project) $
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48680012%2fforce-pipenv-to-create-a-new-virtualenv%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
The current documentation makes it sound like you can set the environment variable PIPENV_IGNORE_VIRTUALENVS
to avoid reusing an already activated virtualenv:
source ~/some/virtualenv/location/bin/activate
PIPENV_IGNORE_VIRTUALENVS=1 pipenv install
I have to admit that I haven't tried this, though.
add a comment |
The current documentation makes it sound like you can set the environment variable PIPENV_IGNORE_VIRTUALENVS
to avoid reusing an already activated virtualenv:
source ~/some/virtualenv/location/bin/activate
PIPENV_IGNORE_VIRTUALENVS=1 pipenv install
I have to admit that I haven't tried this, though.
add a comment |
The current documentation makes it sound like you can set the environment variable PIPENV_IGNORE_VIRTUALENVS
to avoid reusing an already activated virtualenv:
source ~/some/virtualenv/location/bin/activate
PIPENV_IGNORE_VIRTUALENVS=1 pipenv install
I have to admit that I haven't tried this, though.
The current documentation makes it sound like you can set the environment variable PIPENV_IGNORE_VIRTUALENVS
to avoid reusing an already activated virtualenv:
source ~/some/virtualenv/location/bin/activate
PIPENV_IGNORE_VIRTUALENVS=1 pipenv install
I have to admit that I haven't tried this, though.
answered Mar 13 '18 at 14:08
karlsonkarlson
3,23422049
3,23422049
add a comment |
add a comment |
If you're in a new project directory, these commands create a new virtualenv using pipenv:
Create a new virtualenv with python 2:
pipenv --two
Create a new virtualenv with python 3:
pipenv --three
Create a new virtualenv with an arbitrary python version:
pipenv --python 3.6.4
That doesn't work for me. I think it's because I've installedpipenv
in a virtualenv. It says it's reusing that virtualenv instead of creating a new one. My question is whether I can tell it to create a new one anyway.
– Don Kirkby
Feb 11 '18 at 4:37
I see what you’re getting at. If you’d like to keep your installation of pipenv separate from system dependencies, but use it to create new virtualenvs, you might try using the fancy installation method in the docs. docs.pipenv.org/install/#fancy-installation-of-pipenv. The suggestion is to install pipenv with pipsi, which puts it into an isolated virtualenv but makes it available as a command globally.
– philngo
Feb 11 '18 at 6:45
Another option you could use ispipenv install <package> --system
, which would tell pipenv to use the current virtualenv (still not creating a separate one), but that would likely require installing pipenv into each new project virtualenv you create. It would, however, let you keep separated virtualenvs for each project. Maybe a trade-off you're willing to make.
– philngo
Feb 11 '18 at 6:59
add a comment |
If you're in a new project directory, these commands create a new virtualenv using pipenv:
Create a new virtualenv with python 2:
pipenv --two
Create a new virtualenv with python 3:
pipenv --three
Create a new virtualenv with an arbitrary python version:
pipenv --python 3.6.4
That doesn't work for me. I think it's because I've installedpipenv
in a virtualenv. It says it's reusing that virtualenv instead of creating a new one. My question is whether I can tell it to create a new one anyway.
– Don Kirkby
Feb 11 '18 at 4:37
I see what you’re getting at. If you’d like to keep your installation of pipenv separate from system dependencies, but use it to create new virtualenvs, you might try using the fancy installation method in the docs. docs.pipenv.org/install/#fancy-installation-of-pipenv. The suggestion is to install pipenv with pipsi, which puts it into an isolated virtualenv but makes it available as a command globally.
– philngo
Feb 11 '18 at 6:45
Another option you could use ispipenv install <package> --system
, which would tell pipenv to use the current virtualenv (still not creating a separate one), but that would likely require installing pipenv into each new project virtualenv you create. It would, however, let you keep separated virtualenvs for each project. Maybe a trade-off you're willing to make.
– philngo
Feb 11 '18 at 6:59
add a comment |
If you're in a new project directory, these commands create a new virtualenv using pipenv:
Create a new virtualenv with python 2:
pipenv --two
Create a new virtualenv with python 3:
pipenv --three
Create a new virtualenv with an arbitrary python version:
pipenv --python 3.6.4
If you're in a new project directory, these commands create a new virtualenv using pipenv:
Create a new virtualenv with python 2:
pipenv --two
Create a new virtualenv with python 3:
pipenv --three
Create a new virtualenv with an arbitrary python version:
pipenv --python 3.6.4
edited Feb 10 '18 at 18:16
answered Feb 10 '18 at 17:19
philngophilngo
485311
485311
That doesn't work for me. I think it's because I've installedpipenv
in a virtualenv. It says it's reusing that virtualenv instead of creating a new one. My question is whether I can tell it to create a new one anyway.
– Don Kirkby
Feb 11 '18 at 4:37
I see what you’re getting at. If you’d like to keep your installation of pipenv separate from system dependencies, but use it to create new virtualenvs, you might try using the fancy installation method in the docs. docs.pipenv.org/install/#fancy-installation-of-pipenv. The suggestion is to install pipenv with pipsi, which puts it into an isolated virtualenv but makes it available as a command globally.
– philngo
Feb 11 '18 at 6:45
Another option you could use ispipenv install <package> --system
, which would tell pipenv to use the current virtualenv (still not creating a separate one), but that would likely require installing pipenv into each new project virtualenv you create. It would, however, let you keep separated virtualenvs for each project. Maybe a trade-off you're willing to make.
– philngo
Feb 11 '18 at 6:59
add a comment |
That doesn't work for me. I think it's because I've installedpipenv
in a virtualenv. It says it's reusing that virtualenv instead of creating a new one. My question is whether I can tell it to create a new one anyway.
– Don Kirkby
Feb 11 '18 at 4:37
I see what you’re getting at. If you’d like to keep your installation of pipenv separate from system dependencies, but use it to create new virtualenvs, you might try using the fancy installation method in the docs. docs.pipenv.org/install/#fancy-installation-of-pipenv. The suggestion is to install pipenv with pipsi, which puts it into an isolated virtualenv but makes it available as a command globally.
– philngo
Feb 11 '18 at 6:45
Another option you could use ispipenv install <package> --system
, which would tell pipenv to use the current virtualenv (still not creating a separate one), but that would likely require installing pipenv into each new project virtualenv you create. It would, however, let you keep separated virtualenvs for each project. Maybe a trade-off you're willing to make.
– philngo
Feb 11 '18 at 6:59
That doesn't work for me. I think it's because I've installed
pipenv
in a virtualenv. It says it's reusing that virtualenv instead of creating a new one. My question is whether I can tell it to create a new one anyway.– Don Kirkby
Feb 11 '18 at 4:37
That doesn't work for me. I think it's because I've installed
pipenv
in a virtualenv. It says it's reusing that virtualenv instead of creating a new one. My question is whether I can tell it to create a new one anyway.– Don Kirkby
Feb 11 '18 at 4:37
I see what you’re getting at. If you’d like to keep your installation of pipenv separate from system dependencies, but use it to create new virtualenvs, you might try using the fancy installation method in the docs. docs.pipenv.org/install/#fancy-installation-of-pipenv. The suggestion is to install pipenv with pipsi, which puts it into an isolated virtualenv but makes it available as a command globally.
– philngo
Feb 11 '18 at 6:45
I see what you’re getting at. If you’d like to keep your installation of pipenv separate from system dependencies, but use it to create new virtualenvs, you might try using the fancy installation method in the docs. docs.pipenv.org/install/#fancy-installation-of-pipenv. The suggestion is to install pipenv with pipsi, which puts it into an isolated virtualenv but makes it available as a command globally.
– philngo
Feb 11 '18 at 6:45
Another option you could use is
pipenv install <package> --system
, which would tell pipenv to use the current virtualenv (still not creating a separate one), but that would likely require installing pipenv into each new project virtualenv you create. It would, however, let you keep separated virtualenvs for each project. Maybe a trade-off you're willing to make.– philngo
Feb 11 '18 at 6:59
Another option you could use is
pipenv install <package> --system
, which would tell pipenv to use the current virtualenv (still not creating a separate one), but that would likely require installing pipenv into each new project virtualenv you create. It would, however, let you keep separated virtualenvs for each project. Maybe a trade-off you're willing to make.– philngo
Feb 11 '18 at 6:59
add a comment |
It looks like pipenv has gotten smarter about this situation. Here's what worked for me. First, I installed a bootstrap environment following virtualenv's installation documentation to use it locally from source. That way, I don't need to touch the system Python, and I can install pipenv in the bootstrap environment:
$ curl --location --output virtualenv.tar.gz https://github.com/pypa/virtualenv/tarball/16.1.0
$ tar -xzf virtualenv.tar.gz
$ python pypa-virtualenv-4ad2742/src/virtualenv.py vbootstrap
$ rm -r virtualenv.tar.gz pypa-virtualenv-4ad2742/
$ vbootstrap/bin/pip install pipenv
Then I created a new project folder, and used pipenv to install numpy:
$ mkdir my_project
$ cd my_project
$ ../vbootstrap/bin/pipenv install numpy
Creating a virtualenv for this project...
Pipfile: /home/vagrant/my_project/Pipfile
Using /home/vagrant/vbootstrap/bin/python (2.7.15rc1) to create virtualenv...
✔ Complete
Already using interpreter /home/vagrant/vbootstrap/bin/python
Using real prefix '/usr'
New python executable in /home/vagrant/.local/share/virtualenvs/my_project-KmT425B_/bin/python
Installing setuptools, pip, wheel...
done.
Virtualenv location: /home/vagrant/.local/share/virtualenvs/my_project-KmT425B_
Creating a Pipfile for this project...
Installing numpy...
Adding numpy to Pipfile's [packages]...
✔ Installation Succeeded
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
✔ Success!
Updated Pipfile.lock (57a39c)!
Installing dependencies from Pipfile.lock (57a39c)...
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 1/1 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
To make it easier to use, I created a symbolic link:
$ ln -s ~/vbootstrap/bin/pipenv ~/pipenv
$ ~/pipenv shell
Launching subshell in virtual environment...
vagrant@vagrant:~/my_project$ . /home/vagrant/.local/share/virtualenvs/my_project-KmT425B_/bin/activate
(my_project) $
add a comment |
It looks like pipenv has gotten smarter about this situation. Here's what worked for me. First, I installed a bootstrap environment following virtualenv's installation documentation to use it locally from source. That way, I don't need to touch the system Python, and I can install pipenv in the bootstrap environment:
$ curl --location --output virtualenv.tar.gz https://github.com/pypa/virtualenv/tarball/16.1.0
$ tar -xzf virtualenv.tar.gz
$ python pypa-virtualenv-4ad2742/src/virtualenv.py vbootstrap
$ rm -r virtualenv.tar.gz pypa-virtualenv-4ad2742/
$ vbootstrap/bin/pip install pipenv
Then I created a new project folder, and used pipenv to install numpy:
$ mkdir my_project
$ cd my_project
$ ../vbootstrap/bin/pipenv install numpy
Creating a virtualenv for this project...
Pipfile: /home/vagrant/my_project/Pipfile
Using /home/vagrant/vbootstrap/bin/python (2.7.15rc1) to create virtualenv...
✔ Complete
Already using interpreter /home/vagrant/vbootstrap/bin/python
Using real prefix '/usr'
New python executable in /home/vagrant/.local/share/virtualenvs/my_project-KmT425B_/bin/python
Installing setuptools, pip, wheel...
done.
Virtualenv location: /home/vagrant/.local/share/virtualenvs/my_project-KmT425B_
Creating a Pipfile for this project...
Installing numpy...
Adding numpy to Pipfile's [packages]...
✔ Installation Succeeded
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
✔ Success!
Updated Pipfile.lock (57a39c)!
Installing dependencies from Pipfile.lock (57a39c)...
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 1/1 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
To make it easier to use, I created a symbolic link:
$ ln -s ~/vbootstrap/bin/pipenv ~/pipenv
$ ~/pipenv shell
Launching subshell in virtual environment...
vagrant@vagrant:~/my_project$ . /home/vagrant/.local/share/virtualenvs/my_project-KmT425B_/bin/activate
(my_project) $
add a comment |
It looks like pipenv has gotten smarter about this situation. Here's what worked for me. First, I installed a bootstrap environment following virtualenv's installation documentation to use it locally from source. That way, I don't need to touch the system Python, and I can install pipenv in the bootstrap environment:
$ curl --location --output virtualenv.tar.gz https://github.com/pypa/virtualenv/tarball/16.1.0
$ tar -xzf virtualenv.tar.gz
$ python pypa-virtualenv-4ad2742/src/virtualenv.py vbootstrap
$ rm -r virtualenv.tar.gz pypa-virtualenv-4ad2742/
$ vbootstrap/bin/pip install pipenv
Then I created a new project folder, and used pipenv to install numpy:
$ mkdir my_project
$ cd my_project
$ ../vbootstrap/bin/pipenv install numpy
Creating a virtualenv for this project...
Pipfile: /home/vagrant/my_project/Pipfile
Using /home/vagrant/vbootstrap/bin/python (2.7.15rc1) to create virtualenv...
✔ Complete
Already using interpreter /home/vagrant/vbootstrap/bin/python
Using real prefix '/usr'
New python executable in /home/vagrant/.local/share/virtualenvs/my_project-KmT425B_/bin/python
Installing setuptools, pip, wheel...
done.
Virtualenv location: /home/vagrant/.local/share/virtualenvs/my_project-KmT425B_
Creating a Pipfile for this project...
Installing numpy...
Adding numpy to Pipfile's [packages]...
✔ Installation Succeeded
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
✔ Success!
Updated Pipfile.lock (57a39c)!
Installing dependencies from Pipfile.lock (57a39c)...
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 1/1 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
To make it easier to use, I created a symbolic link:
$ ln -s ~/vbootstrap/bin/pipenv ~/pipenv
$ ~/pipenv shell
Launching subshell in virtual environment...
vagrant@vagrant:~/my_project$ . /home/vagrant/.local/share/virtualenvs/my_project-KmT425B_/bin/activate
(my_project) $
It looks like pipenv has gotten smarter about this situation. Here's what worked for me. First, I installed a bootstrap environment following virtualenv's installation documentation to use it locally from source. That way, I don't need to touch the system Python, and I can install pipenv in the bootstrap environment:
$ curl --location --output virtualenv.tar.gz https://github.com/pypa/virtualenv/tarball/16.1.0
$ tar -xzf virtualenv.tar.gz
$ python pypa-virtualenv-4ad2742/src/virtualenv.py vbootstrap
$ rm -r virtualenv.tar.gz pypa-virtualenv-4ad2742/
$ vbootstrap/bin/pip install pipenv
Then I created a new project folder, and used pipenv to install numpy:
$ mkdir my_project
$ cd my_project
$ ../vbootstrap/bin/pipenv install numpy
Creating a virtualenv for this project...
Pipfile: /home/vagrant/my_project/Pipfile
Using /home/vagrant/vbootstrap/bin/python (2.7.15rc1) to create virtualenv...
✔ Complete
Already using interpreter /home/vagrant/vbootstrap/bin/python
Using real prefix '/usr'
New python executable in /home/vagrant/.local/share/virtualenvs/my_project-KmT425B_/bin/python
Installing setuptools, pip, wheel...
done.
Virtualenv location: /home/vagrant/.local/share/virtualenvs/my_project-KmT425B_
Creating a Pipfile for this project...
Installing numpy...
Adding numpy to Pipfile's [packages]...
✔ Installation Succeeded
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
✔ Success!
Updated Pipfile.lock (57a39c)!
Installing dependencies from Pipfile.lock (57a39c)...
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 1/1 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
To make it easier to use, I created a symbolic link:
$ ln -s ~/vbootstrap/bin/pipenv ~/pipenv
$ ~/pipenv shell
Launching subshell in virtual environment...
vagrant@vagrant:~/my_project$ . /home/vagrant/.local/share/virtualenvs/my_project-KmT425B_/bin/activate
(my_project) $
edited Dec 8 '18 at 5:17
answered Nov 24 '18 at 0:35
Don KirkbyDon Kirkby
27.6k10129206
27.6k10129206
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48680012%2fforce-pipenv-to-create-a-new-virtualenv%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
To separate environments, you just need to run
pipenv
in other project's directory. Be sure to deactivate your current virtualenv first.– Sraw
Feb 8 '18 at 8:26
To clarify, @Sraw,
pipenv
is only installed in a virtualenv. I don't want to install it in my system Python. I can't deactivate my current virtualenv, because that's wherepipenv
is installed.– Don Kirkby
Feb 8 '18 at 19:35