EzDevInfo.com

virtualenv

Virtual Python Environment builder Virtualenv — virtualenv 13.1.2 documentation

What is the official "preferred" way to install pip and virtualenv systemwide?

Is it this, which people seem to recommend most often:

$ sudo apt-get install python-setuptools
$ sudo easy_install pip
$ sudo pip install virtualenv

Or this, which I got from http://www.pip-installer.org/en/latest/installing.html:

$ curl -O https://github.com/pypa/virtualenv/raw/master/virtualenv.py
$ python virtualenv.py my_new_env
$ . my_new_env/bin/activate
(my_new_env)$ pip install ...

Or something entirely different?


Source: (StackOverflow)

What are the Python equivalents to Ruby's bundler / Perl's carton?

I know about virtualenv and pip. But these are a bit different from bundler/carton.

For instance:

  • pip writes the absolute path to shebang or activate script
  • pip doesn't have the exec sub command (bundle exec bar)
  • virtualenv copies the Python interpreter to a local directory

Does every Python developer use virtualenv/pip? Are there other package management tools for Python?


Source: (StackOverflow)

Advertisements

Rename an environment with virtualenvwrapper

I have an environment called doors and I would like to rename it to django for the virtualenvwrapper.

I've noticed that if I just rename the folder ~/.virtualenvs/doors to django, I can now call workon django, but the environment still says (doors)hobbes3@hobbes3.


Source: (StackOverflow)

Renaming a virtualenv folder without breaking it

I've created folder and initialized a virtualenv instance in it.

$ mkdir myproject
$ cd myproject
$ virtualenv env

When I run (env)$ pip freeze, it shows the installed packages as it should.

Now I want to rename myproject/ to project/.

$ mv myproject/ project/

However, now when I run

$ . env/bin/activate
(env)$ pip freeze

it says pip is not installed. How do I rename the project folder without breaking the environment?


Source: (StackOverflow)

How do I remove/delete a virtualenv?

I created an environment with the following command: virtualenv venv --distribute

I cannot remove it with the following command: rmvirtualenv venv

I do an lson my current directory and I still see venv

The only way I can remove it seems to be: sudo rm -rf venv

Note that the environment is not active. I'm running Ubuntu 11.10. Any ideas? I've tried rebooting my system to no avail.


Source: (StackOverflow)

How do I update pip itself from inside my virtual environment?

I'm able to update pip-managed packages, but how do I update pip itself? According to pip --version, I currently have pip 1.1 installed in my virtualenv and I want to update to the latest version.

What's the command for that? Do I need to use distribute or is there a native pip or virtualenv command? I've already tried pip update and pip update pip with no success.


Source: (StackOverflow)

How to leave/exit/deactivate a python virtualenv?

I'm using virtualenv and the virtualenvwrapper. I can switch between virtualenv's just fine using the workon command.

me@mymachine:~$ workon env1
(env1)me@mymachine:~$ workon env2
(env2)me@mymachine:~$ workon env1
(env1)me@mymachine:~$

However, how do I exit all virtual machines and workon my real machine again? Right now, the only way I have of getting back to

me@mymachine:~$

is to exit the shell and start a new one. That's kind of annoying. Is there a command to workon "nothing", and if so, what is it? If such a command does not exist, how would I go about creating it?


Source: (StackOverflow)

Use different Python version with virtualenv

I have a Debian system currently running with python 2.5.4. I got virtualenv properly installed, everything is working fine. Is there a possibility that I can use a virtualenv with a different version of Python?

I compiled Python 2.6.2 and would like to use it with some virtualenv. Is it enough to overwrite the binary file? Or do I have to change something in respect to the libraries?


Source: (StackOverflow)

Can I install Python windows packages into virtualenvs?

Virtualenv is great: it lets me keep a number of distinct Python installations so that different projects' dependencies aren't all thrown together into a common pile.

But if I want to install a package on Windows that's packaged as a .exe installer, how can I direct it to install into the virtualenv? For example, I have pycuda-0.94rc.win32-py2.6.exe. When I run it, it examines the registry, and finds only one Python26 to install into, the common one that my virtualenv is based off of.

How can I direct it to install into the virtualenv?


Source: (StackOverflow)

Revert the `--no-site-packages` option with virtualenv

I have created a virtualenv using the --no-site-packages option and installed lots of libraries. Now I would like to revert the --no-site-packages option and use also the global packages.

Can I do that without recreating the virtualenv?

More precisely:

I wonder what exactly happens when creating a virtualenv using the --no-site-packages option as opposed to not using that option.

If I know what happens then I can figure out how to undo it.


Source: (StackOverflow)

Comprehensive beginner's virtualenv tutorial? [closed]

I've been hearing the buzz about virtualenv lately, and I'm interested. But all I've heard is a smattering of praise, and don't have a clear understanding of what it is or how to use it.

I'm looking for (ideally) a follow-along tutorial that can take me from Windows or Linux with no Python on it, and explain every step of (in no particular order):

  • what I should do to be able to start using virtualenv
  • specific reasons why using virtualenv is a good idea
  • situations where I can/can't use virtualenv
  • situations where I should/shouldn't use virtualenv

And step through (comprehensively) a couple sample situations of the should+can variety.

So what are some good tutorials to cover this stuff? Or if you have the time and interest, perhaps you can answer a few of those questions here. Either in your answer, or as a link to tutorials that answer it, these are the things I'd like to know.


Source: (StackOverflow)

setting an environment variable in virtualenv

I have a Heroku project that uses environment variables to get its configuration, but I use virtualenv to test my app locally first.

Is there a way to set the environment variables defined on the remote machine inside virtualenv?


Source: (StackOverflow)

Is it possible to install another version of Python to Virtualenv?

I have a shared account in a web-hosting that has Python 2.4 installed, but my code is not compatible with 2.4. Is it possible to install Python 2.6 directly to Virtualenv?

Note: I donĀ“t have permission to install it in the shared server.


Source: (StackOverflow)

is there an virtual environment for node.js?

I've searched the wiki modules page, but i can't find anything similar to virtualenv (python) or rvm.

Anyone here separates node.js in their own env? I really don't like to install npm system-wide.


Source: (StackOverflow)

Python: Determine if running inside virtualenv

Is it possible to determine if the current script is running inside a virtualenv environment?


Source: (StackOverflow)