Questions tagged [virtualenv]

virtualenv is a tool that creates sandboxed Python environments.

virtualenv allows you to create a sandboxed and isolated environment where Python packages can be installed without interfering with other packages on the same machine. With several virtualenvs, many different pieces of Python software with different and even mutually exclusive dependencies can live together.

The source code of this tool is hosted on GitHub.

Basic usage:

$ virtualenv ENV
$ source ENV/bin/activate
(ENV) $ easy_install (package)
(ENV) $ deactivate
$ ...

See the Command reference for a complete list of all available commands.

7398 questions
4
votes
1 answer

Base classes missing with Pydev interpreter and virtualenv

Ok, so if I create a brand new virtualenv, then hop into that environment, go into a python shell within that environment, and run 'import logging', for instance, it imports absolutely fine. I can then start up eclipse, create a new interpreter…
seaders
  • 3,878
  • 3
  • 40
  • 64
4
votes
1 answer

Can't run Apache2 with virtualenv

I'm making a website based on Django, on the server was installed a Python 3.5, but my project requires a Python 3.6. I decided to use virtualenv. I successfuly installed needed version of Python but I can't make it works with Apatche2 using…
sal-k
  • 91
  • 8
4
votes
1 answer

Can I have a virtualenv specific .pypirc file?

Pip lets it's config file (pip.ini or pip.conf) live inside the virtualenv. That's neat if you want to make your package resolution different in a specific environment. But what about the .pypirc file? This normally lives in ${HOME}/.pypirc or…
Salim Fadhley
  • 6,975
  • 14
  • 46
  • 83
4
votes
0 answers

Specifying Python Version in Virtual Environment

I have installed python 3.6 at /usr/bin/python3.6 and I am trying to create a virtualenv using this version of python. I tried virtualenv --python=/usr/bin/python3.6 testenv and then I activated the virtualenv with source…
user1893354
  • 5,778
  • 12
  • 46
  • 83
4
votes
1 answer

How to configure pip to use editable installs to fulfill requirements

I'm trying to write a script that uses mkvirtualenv to re-make a virtual environment from the requirements recorded earlier with pip freeze > . The original environment includes some editable installs (setuptools develop mode installs)…
maf
  • 305
  • 1
  • 9
4
votes
0 answers

Centos7: python-ldap installation with pip

I have asked this question before and was solved by gcc installation but I am currently migrating the app to production machine. I have installed gcc, python-devel, openssl-devel, kernel-devel, openldap-devel, I even tried yum groupinstall…
JMY
  • 57
  • 1
  • 7
4
votes
4 answers

AttributeError: 'module' object has no attribute 'lru_cache'

Im getting the error as shown in title with this environment setup. Apache2 with mod_wsgi ,Python 3.5, Django 2.0.2 . I'm using virtualevn. my virtual env is in : /home/santosh/Documents/project/project/ and django app is in…
santosh
  • 129
  • 1
  • 12
4
votes
1 answer

How to install Python modules within a virtualenv programatically?

Before I get downvotes, this is not a duplicate. I have exhausted both google and SO. In SO, there are questions regarding how Python modules can be installed. But my question is creating a venv and installing modules to this created venv…
Vino
  • 2,111
  • 4
  • 22
  • 42
4
votes
1 answer

Activate virtualenv using alias

I can activate my python virtual environment from it's folder by entering . bin/activate. I'd like to instead type a single word alias, such as shazam, from the home folder (or anywhere else) that activates the environment, changes to my master…
landrykid
  • 39
  • 1
  • 6
4
votes
1 answer

Install packages into virtual environment with apt-get

I'm trying to create a virtual environment for my Python3 project. The problem is, some of the dependencies I'm trying to install into the virtualenv aren't through pip. For example, to get LibTorrent, I had to run: $ sudo apt-get install…
Sam
  • 2,172
  • 3
  • 24
  • 43
4
votes
2 answers

Python 3.5 create virtualenv with python2.7

I have Python 3.5 installed in my windows machine and that is the only version I have on my computer. I want to create a python2.7 virtual environment to try out a certain package. Is it possible to create a virtual environment with python2.7…
JeanVuda
  • 1,738
  • 14
  • 29
4
votes
1 answer

"pip freeze" shows extra packages too?

I'm trying to do a pip freeze -l > requirements.txt. I'm running this in a virtualenv. However, even with the -l option, pip freeze gives me a list of all the packages installed in my system, which is a huge and unnecessarily long list. All I need…
kranberry
  • 324
  • 1
  • 4
  • 10
4
votes
1 answer

virtualenv use upgraded system default pip

How do I get my virtual environments to use my system upgraded pip? Before creating a virtualenv, pip shows version 9.0.1, but inside the virtual environment it reverts back to 8.1.1, forcing me to upgrade all my virtualenv pips. $ pip --version pip…
JDiMatteo
  • 12,022
  • 5
  • 54
  • 65
4
votes
3 answers

Python Popen doesn't recognize scrapy when python script is run as systemd service

I have a python script main.py that needs to start the scrapy executable, so I use Popen to do that (using subprocess.call() has same result). To simplify things I just run the help argument of scrapy. import subprocess ... p =…
Mr Alexander
  • 339
  • 1
  • 5
  • 13
4
votes
2 answers

How to CLONE LOCAL python environment (+ALL packages) into virtualenv?

I want to CLONE Python and ALL installed packages into virtual environment using virtualenv. there are couple of answers here on Stackoverflow (How to create a virtualenv by cloning the current local environment?) - they recommend doing the pip…
User New
  • 404
  • 7
  • 23