pip-python not found within virtual environment - python

I've installed python-virtualenv and python-virtualenvwrapper, and created a virtual environment by using mkvirtualenv NAME, and then activated it through workon NAME. By looking in ~/.virtualenvs/NAME/bin I see that pip is installed there.
However, when I try and install anything through pip, I'm told pip-python: command not found
I have not installed pip system wide, and was under the impression that I did not need to, given that it was already installed inside the virtual environment. Now, all this leads me to believe that something is not being set correctly with my $PATH, what could that be though? Once I'm in side the virtual environment as such: (NAME)[user#host]$ shouldn't my path already be modified to use the pip installation inside that environment? What do I need to do to make this so?

You must install pip on you system to make it accessible in virtualenv.

pip-python is the name of the executable in some Linux distributions. It is on my Fedora machine.
When pip is installed in a virtualenv, the name of the executable is simply pip, not pip-python. So you need to execute it with ~/.virtualenvs/NAME/bin/pip, not ~/.virtualenvs/NAME/bin/pip-python.

Related

How to stop python from installing modules in specific virtual environment and install them globally?

I was wondering How can I stop python from installing modules in specific virtual environment and install them globally;or probably virtaulenv won't let me do that!?
if you have (venv) before you terminal input, your virtual environment is activates. so you can using deactivate command for deactivating. in addition if you have a (base) you should be closing your anaconda base environment so you can see this answer
You simply install the package without activating your virtual environment. Once you install your package that way, it would be installed globally instead of inside a global environment.
Also, to confirm this, you can activate your virtual environment and run the command pip list , this will show all the packages in that virtual environment, and also try deactivating the virtual environment and run the command pip list, this would show all packages in the system.
I hope this answers your question
I believe I've found some sort of solution ,by just typing "pip install -target C:\Users\YOURNAME\AppData\Roaming\Python\Python37\site-packages"
it's kind of a lame solution but I think it's better than nothing!
By the way there was no pip.exe in my python folder!!!

What does it mean to get an "-e" value when listing installed packages with pip freeze?

I just created a new virtual environment in my Windows 8 box, I have not installed any package yet. After activating the new virtual environment, if I do a pip freeze, I get a weird reference to a github project. What does that mean? How do I get rid of it?
(my_virtual_env) C:\>pip freeze
-e git+git#github.com:my_repo.git#221689bbe130338b04a2d837ebe69a9ccc695f8a#egg=my_repo-origin/my_branch
If you want new virtualenvs to be completely clean, then use:
virtualenv --no-site-packages new-virtualenv-name
...when generating them. Otherwise, they contain all packages installed in your main Python installation (outside any virtualenv).

Virtualenvwrapper can't find virtualenv on Mavericks

Installed virtualenv and virtualenvwrapper via pip (globally.) All other python (2.7) packages/binaries/libraries are installed/managed via MacPorts (including pip.)
virtualenv in not on the PATH because pip installs it to '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages'. I get errors when running virtualenvwrapper commands saying that virtualenv can't be found on PATH. But I'm confused why adding this directory to the PATH is not mentioned anywhere (blogs, virtualenv site, virtualenvwrapper site, here) so it feels like I'm missing something. I don't want to add this directory to the path because it feels like it's going to affect my system when I switch python versions depending upon what I'm working on...
So how do I fix this?
There are versions of virtualenv and virtualenv in both pip and MacPorts. The virtualenv site suggests installing virtualenv/-wrapper via pip; however, I assume the MacPorts version(s) would not have this problem.
The MacPorts version of virtualenv is in fact select-able between different versions by using e.g.:
port select --set virtualenv virtualenv27
However, there select command does not work for virtualenvwrapper, because the group 'virtualenvwrapper' does not exist.

Virtualenv installing to local instead of virtual

I am trying to install OpenERP server into a virtual enviroment that I created for that. I created the virtual using
mkvirtualenv openerp_rev5054
On said virtual enviroment I use
> (openerp_rev5054)user#machine:python setup.py install --record files.txt
And gives that I have no permission, and if I install it with root access, it goes directly into my python local install. Here is a sample of my files.txt with the location of all the files installed.
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/import_xml.rng
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/release.pyc
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/netsvc.pyc
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/loglevels.pyc
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/__init__.pyc
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/sql_db.pyc
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/release.py
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/http.py
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/PKG-INFO
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/pooler.py
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/loglevels.py
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/pooler.pyc
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/__init__.py
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/exceptions.pyc
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/sql_db.py
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/http.pyc
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/netsvc.py
/usr/local/lib/python2.7/dist-packages/openerp-7.saas_3-py2.7.egg/openerp/exceptions.py
I have a couple of others already installed and the procedure was the same so I see no reason why this one should behave different in any way. Has anyone encountered an issue like this?
Try installing with pip rather than setup.py. I hear that pip plays nicer with virtual environments.
Check to make sure that your virtualenv is activated. If it is, you should have an environment variable $VIRTUAL_ENV that has the value of the root directory of the virtualenv. Or, more commonly, you'll see a change in your shell prompt.
If it is activated, make sure that your $PATH is correct, perhaps something else has come along and changed it. which python should point at a python inside your virtualenv bin directory.
If you have an old version of virtualenv, ensure you're using --no-site-packages

Creating a python virtualenv in Ubuntu 12.04 accessing system installed python packages before local venv packages

I am installing virtualenv and it seems to access the system site packages before accessing the local site packages. Ipython is required by some other programs so it was automatically installed. This only happened recently and now it finds that version instead of the one found locally in the environment.
How do I tell the environment to use local packages within the environment before global packages? Can you set the Path variable for within the environment?
Ended up being an error with previously had set the PYTHON_PATH variable in .bashrc so this was looking in the system built directories before looking locally. Kind of defeating the purpose of virtual_env.
If you are using distribute + pip to manage dependencies simply run pip -l freeze > requirements.txt, this creates a dependency list of all your local packages. Next remove the current virtualenv; rerun the virtualenv command and specify the --no-site-packages option. Activate your new environment and finally pip install -r requirements.txt to download all the dependencies from the requirements file.

Categories

Resources