virtualenv
problems with python and virtualenvwrapper after updating: No module named virtualenvwrapper
If you have modified your virtualenvwrapper to point to python3, like I do, add the following line in your .bashrc file : export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 making sure that it’s placed before the following line (if you have it): source /usr/local/bin/virtualenvwrapper.sh Then, make sure you install the virtualenv and virtualenvwrapper using: sudo /usr/local/bin/pip3 install virtualenv virtualenvwrapper
Copy complete virtualenv to another pc
Do the following steps on the source machine: workon [environment_name] pip freeze > requirements.txt copy requirements.txt to other PC On the other PC: create a virtual environment using mkvirtualenv [environment_name] workon [environment_name] pip install -r requirements.txt You should be done. Other Resources: How to Copy/Clone a Virtual Environment from Server to Local Machine
pip: Could not find an activated virtualenv (required)
Open your ~/.bashrc file and see if this line is there – export PIP_REQUIRE_VIRTUALENV=true It might be causing the trouble. If it’s there, change it to false and run – source ~/.bashrc If not, run export PIP_REQUIRE_VIRTUALENV=false from terminal. Note: everything works the same if you have .bash_profile instead of .bashrc in your current user’s … Read more
Execute Python script within Jupyter notebook using a specific virtualenv
Here’s what worked for me (non conda python): (MacOS, brew version of python. if you are working with system python, you may (will) need prepend each command with sudo) First activate virtualenv. If starting afresh then, e.g., you could use virtualenvwrapper: $ pip install virtualenvwrapper $ mkvirtualenv -p python2 py2env $ workon py2env # This … Read more
“Failed building wheel for psycopg2” – MacOSX using virtualenv and pip
For MacOS users After trying all the above methods (which did not work for me on MacOS 10.14), that one worked : Install openssl with brew install openssl if you don’t have it already. add openssl path to LIBRARY_PATH : export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/ install psycopg2 with pip pip3 install psycopg2
Using VirtualEnv with multiple Python versions on windows
Better: py -3.4 -m venv c:\path\to\wherever\you\want\it If you don’t have the py.exe launcher (but it should be installed) you can replace py -3.4 with c:\Python34\python.exe (assuming the default location) This works because of the handy-dandy, Windows-versioningest, super nice runtime picker py.exe By default, py.exe will be present on a Windows install (I think it comes … Read more
how to pip uninstall with virtualenv on heroku cedar stack?
Updated 2013-09-30: the current way to clear the virtualenv seems to specify a different python runtime version in runtime.txt as stated on Github and in the Heroku’s devcenter reference. Be aware that Heroku currently “only endorses and supports the use of Python 2.7.4 and 3.3.2” so unless your application supports both Python 2.7.4 and 3.3.2, … Read more
Getting a ‘source: not found’ error when using source in a bash script
If you’re writing a bash script, call it by name: #!/bin/bash /bin/sh is not guaranteed to be bash. This caused a ton of broken scripts in Ubuntu some years ago (IIRC). The source builtin works just fine in bash; but you might as well just use dot like Norman suggested.
Upgrade Python in a virtual environment
If you happen to be using the venv module that comes with Python 3.3+, it supports an –upgrade option. Per the docs: Upgrade the environment directory to use this version of Python, assuming Python has been upgraded in-place python3 -m venv –upgrade ENV_DIR