virtualenvwrapper not installing correctly? - python

I am trying to use a Python virtual environment for the first time while trying to learn Django. I am using the instructions here. As I am using git bash on Windows, I am following the setup instructions for Windows.
I installed virtualenvwrapper using
pip3 install virtualenvwrapper-win
Now the command mkvirtualenv gets me bash: mkvirtualenv: command not found
I tried the solutions here to no avail.
pip3 list shows that the package is, in fact, installed, but there is no virtualenvwrapper (or virtualenv) .sh files in the site-packages directory, and the only related file I can find is virtualenvwrapper_win-1.2.5-py3.6.egg-info in an AppData/Roaming directory.
Any suggestions? Thanks.

I had the same problem and tried uninstalling virtualenvwrapper-win, just to see the list of files that would be removed. I saw that the mkvirtualenv was located in C:\Python\Python37\Scripts.
I noticed I was using the 64bit version of python (C:\Python\Python37\) alongside the 32bit one (C:\Python\Python37-32\), both folders being in the PATH of my system's properties. I removed the 32bit version's directories from the PATH and this seemed to work.
PS: I also noticed that running the commands from the MINGW terminal requires them to also have the .bat extension added:

Related

Why does it say that pygame is already installed but I can't use it [duplicate]

Running on Windows 10, I have Python 3.7.3 installed to my c/users/myUser/appdata/local/programs folder.
When I use PIP to install a package, it seems to run fine, but when I use "import package" in python it doesn't recognize that package. What would cause this?
Running 'python --version' works and also running 'pip --version' works.
PIP shows up in my c/users/myUser/appdata/local/programs/python37-32/lib/site-packages/pip folder.
UPDATE:
So I was looking through files to determine where the libraries are located that do work with my python. The folder is located in Python/Python37-32/Lib. All of those currently work when importing. However when I do anything with PIP it does not add anything to that folder.
I noticed there are a couple different PIP executables within Python/Python37-32/Scripts which include pip.exe, pip3.exe, and pip3.7.exe. I tried using "pip3.7 install numpy" which also did not work.
I noticed when trying to add an existing package its pointing to the Python37-32/lib/site-packages folder.
SOLUTION:
I removed python from my machine, and reinstalled it. I had the same problem. What I done to fix this was to use
PS
python -m pip install --user package
Also I appended my PATH environment variable with
cmd
setx path "%path%;C:\Users\MyUser\AppData\Roaming\Python\Python38\Scripts"
That seemed to have taken care of my issue. Now when I install a package with PIP I can reference it through python.

Getting error while saving python file: There is no Pip installer available in the selected environment

I'm getting an error "There is no Pip installer available in the selected environment." when saving python files in Visual Studio Code. I have pip3 installed, and it's available from the terminal. I have selected the python interpreter in the VS Code. I also tried manually installing autopep8 with pip3 in the project directory. But the error still occurs. Unfortunately, these are the only solutions I was able to find on the internet, but none of them worked. I use Lenovo's Chromebook, which is Debian-based. Does anyone have any clue how to solve the issue?
Selected interpreter:
You obviously have installed multiple Python environments on your system. The one in /usr/bin is usually the one installed by your system's package manager (apt on Debian) and most probably the default one that is used if you just call the python commands without absolute path from your shell. You can verify that by calling:
which python3
which pip3
I assume that both binaries are used from /usr/bin/.
Your Python installation selected in VS code is located in /usr/local/bin, which probably has been installed from a different origin (maybe you have compiled Python from source?). If VS code complains that no pip has been found in your selected environment, probably /usr/local/bin/pip3 does not exist for some reason. You can verify that by calling:
ls /usr/local/bin/pip3
Easiest solution to this would be to select the /usr/bin/python3 environment in VS code.
If you really need the Python version from /usr/local/bin, find out where this installation came from and complete it in order to have pip3 there as well.
The most sustainable solution, however, would be to use a virtual environment. This would make your Python version system-independent and you have full control over the packages in there.
I think you should check in your terminal "pip3 freeze" command, if it shows some list , then pip is working, otherwise you should check the environment variable in your system for pip3.

Issues setting up Virtualenv and Virtualenvwrapper

I'm trying to install virtualenv and virtualenvwrapper so that I can do some django work.
I'm not exactly sure where the issue is stemming from. I currently have installed Jupyter Notebook and installed a lot of python files though it (python 3+ I believe), so when I did pip install virtualevnwrapper, the location of the shell file was in C:/Users/'Andy Renz'/Anaconda3/Scripts/virtualenvwrapper.sh. I account for this in changing by .bashrc file, by including:
export WORKON_HOME=$HOME/.virtualenvs
source C:/Users/'Andy Renz'/Anaconda3/Scripts/virtualenvwrapper.sh
When I run source ~/.bashrc in my shell, I get the following:
bash: /usr/bin/python: No such file or directory
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could no import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and the PATH is
set properly.
I think this means python isn't where it is supposed to be. Virtualenv references python 2+ I believe which leads me to believe my python 2 is somewhere odd. I do have it, not downloaded from Jupyter. How do I account for this and proceed forward?
The issue is you're trying to install the default virtualenvwrapper (for Linux) on a Windows machine. That's why it's trying to get Python from /usr/bin/python, a directory that does not exist in Windows.
Try virtualenvwrapper-win from https://pypi.python.org/pypi/virtualenvwrapper-win
Python is somehow either not installed or installed at different path maybe /usr/local/bin. Use which python or whereis python to check if python is indeed installed and path of installation. Then you can create a softlink to the python executable in your /usr/bin directory.

Installing python packages with no installation directory acces and no pip/easy_install/virtual_env

At work we have python installed, but no additional modules. I want to import some scipy modules but I have no access to the python directory for installation.
Similar questions have been asked on StackOverflow, but the answers always assumed easy install, pip or virtualenv were installed. At my workplace, none of these packages are installed. It's just the plain python installation and nothing else.
Is there still an option for me for installing modules in my local folder and calling them from python? If so, how do I go about it?
Not exactly installing modules on your local folder, but a solution nonetheless:
I used to work for a company that used windows and didn't have admin access, so I ended up using Portable python.
It seems portable python is no longer mantained, but you can see some other portable python solutions on their site, most of which you can run straight from your usb.
You can download pip from here http://pip.readthedocs.org/en/stable/installing/ and install it without root privileges by typing:
python get-pip.py --user
This will install to directory with prefix $HOME/.local so the pip executable will be in the directory $HOME/.local/bin/pip, for your convenience you can add this directory to $PATH by adding to end of .bashrc file this string
export PATH=$HOME/.local/bin/:$PATH
After this you can install any packages by typing
pip install package --user
Or you can alternatively compile the python distribution from source code and install to your home directory to directory $HOME/.local or $HOME/opt or any subfolder of $HOME you prefer, let's call this path $PREFIX. For doing this you have to download python source code from official site, unpack it and then run
./configure --prefix=$PREFIX --enable-shared
make install
And then add python binary to $PATH, python libraries to $LD_LIBRARY_PATH, by adding to the end of $HOME/.bashrc file whit strings
export PATH=$PREFIX/bin:$PATH
export LD_LIBRARY_PATH=$PREFIX/lib
and when after restarting bash you can also run
python get-pip.py
and pip and will be installed automatically to your $PREFIX directory. And all other packages those you will install with pip will be automatically installed also to $PREFIX directory. This way is more involved, but it allows you to have the last version of python.

pip/easy_install failure: failed to create process

After following this article: How do I install pip on Windows? on my Windows system using Enthought Canopy 64 Bit system, I cannot get pip or easy_install to work due to error:
pip install requests
failed to create process
I tried re-installing setuptools, running cmd prompt as admin without any effect.
When I encountered this, it was because I'd manually renamed the directory python was in. This meant that both setuptools and pip had to be reinstalled. Or, I had to manually rename the python directory to what it had been previously.
It will help after changing the PATH to python in environment variables:
python -m pip install --upgrade pip --force-reinstall
Just ran into this. Sort of. Pip worked for me, but after installing pytest-watch, running the ptw script was giving this error.
For some reason, pip stopped quoting the #! in ptw-script.py:
#!C:\Program Files (x86)\Python\python.exe
It worked after I added quotes manually:
#!"C:\Program Files (x86)\Python\python.exe"
I don't really know why this suddenly started happening. Adding this here in case anyone else coming here from Google runs into the same thing.
Here's a related pip issue (I think).
If you intentionally want to rename the folder where python.exe resides, you should also modify all python files in the Scripts folder. So a third solution would be to modify the python files as well: the first line in pip-2.7-script.py originally contain:
#!C:\OriginalPythonDir\python.exe
Modifying this path to the new Python folder fixes the problem.
(P.S. Unfortunately I cannot yet reply to answers, so I'll reply as a new answer because I thought it could be useful for other people as well).
To fix this error (after you change the folder where python is installed) run force-reinstall for pip and pyinstaller, like this:
python -m pip install --upgrade pip --force-reinstall
python -m pip install --upgrade pyinstaller --force-reinstall
I ran into this bug while installing an older version of Python (3.5.2) for compatibility with some aws-adfs scripting. I installed aws-adfs with pip, on Windows 10, and found that while Python is installed to a directory path with spaces in it you will get the failed to create process error.
The pip maintainers say that it was a deeper problem with setuptools and even offered a workaround if you want to patch the installation in place.
But another, easier solution if you're working with older versions of Python is just to reinstall Python to a directory without spaces.
When I came across this problem, I found that my path contained multiple entries for Python. After tidying up my path so that it had an entry for the python installation folder and the scripts folder (in my case C:\Python27 and C:\Python27\Scripts), pip worked properly.
Test this. it's worked correctly for me:
python -m pip install --upgrade pip --force-reinstall
I just use python in the command shell on Windows 7 and had this problem immediately after installing pip. In case the above solutions don't help you, you should check that the folder that pip.exe is installed in (in my case, the Script folder under Python32) is in the Path.
I had installed Anaconda and so I still had C:\Python27 along with C:\Anaconda in my path. When I removed C:\Python27 and all subfolders I was able to use pip again.
Please check out have you ever rename your python.exe
I install python2 and python3 on my PC at the same time , so I rename my python.exe to python3.exe.And when I use pip ,it boom...
After rename it back .It's ok again....
Running command prompt with administrator privileges worked for me.
I had the same problem and none of the above worked for me.
I deleted my venv. And created a new one by specifying the python path:
virtualenv --python C:\Path\To\Python\python.exe venv
.\venv\Scripts\activate
and this worked
Check whether the pip-script points out the exact location of python.exe, because pip always points (C:\python3.3\python.exe). In my system i've installed 2 versions of python i.e python2 & python3. I ve modified the home application of python.exe into python2.exe and python3.exe.
When i installed pip windows installer. it results me out with the error " failed to create process"

Categories