I am trying to install Django in my windows 7 machine, as a prerequisite, I am installing virtualenvwrapper:
pip install virtualenvwrapper-win
But it throws the following error:
Error [WinError 87] The parameter is incorrect while executing command
python setup.py egg_info
Could not install packages due to an EnvironmentError: [WinError 87] The paramet
er is incorrect
[NOTE]:
Python version : Python 3.7.0b4
pip version: pip 10.0.1
Try using pyenv:
Step 1:
install virtualenv using pip
pip install virtualenv
Step 2
In a folder, open cmd and run:
python -m venv virtualenvname
eg:
python -m venv india
Step 3: Activate your Virtual environment by:
india\Scripts\activate
Note: S of sripts has to be in caps
Now you must see india before location in your cmd. If yes then your virtual env has been activated.
Something Like this:
(india) D:\dev\python\django\
pip3 -m venv yourprojectname
Are you trying my command. I got the error like you did with this command I got the problem
but, you can apply the following commands
py -m pip install --user virtualenv
py -m virtualenv env
OR
python3 -m pip install --user virtualenv
python3 -m virtualenv env
Related
I'm learning network automation using python. I'm unable to install Napalm-fortios module in my pycharm because of the error as below.
Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at 'C:\Users\user\PycharmProjects\DUKE\venv\Scripts\python.exe'.
Collecting napalm-fortios
Using cached napalm-fortios-0.4.1.tar.gz (7.0 kB)
ERROR: Command errored out with exit status 1:
command: 'C:\Users\user\PycharmProjects\DUKE\venv\Scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pycharm-packaging\\napalm-fortios\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pycharm-packaging\\napalm-fortios\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\user\AppData\Local\Temp\pycharm-packaging\napalm-fortios\pip-egg-info'
cwd: C:\Users\user\AppData\Local\Temp\pycharm-packaging\napalm-fortios\
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\user\AppData\Local\Temp\pycharm-packaging\napalm-fortios\setup.py", line 6, in <module>
from pip.req import parse_requirements
ModuleNotFoundError: No module named 'pip.req'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Update PIP using below command,
pip install --upgrade pip
Command to install napalm-fortios package,
pip install napalm-fortios
You can try the below solution steps;
The Python "ModuleNotFoundError: No module named 'pip'" occurs when pip is not installed in our Python environment. To solve the error, install the module by running the python -m ensurepip --upgrade command on Linux or MacOS or py -m ensurepip --upgrade on Windows.
Open your terminal and run the following command to install pip.
On Linux or MacOS
python -m ensurepip --upgrade
using python 3
python3 -m ensurepip --upgrade
On Windows
py -m ensurepip --upgrade
The ensurepip package enables us to bootstrap the pip installer into an existing Python installation or virtual environment.
If the PATH for pip is not set up on your machine, replace pip with python3 -m pip:
make sure to use your version of Python, e.g. 3.10
python3 -m pip install requests
Alternatively, you can use the official get-pip script to install pip.
Download the script from https://bootstrap.pypa.io/get-pip.py by clicking on the link, right-clicking and selecting "Save as" in your browser.
Open your terminal in the location where the get-pip.py file is downloaded and run the following command.
On Linux or MacOS
python get-pip.py
using python 3
python3 get-pip.py
On Windows
py get-pip.py
The get-pip.py script uses bootstrapping logic to install pip.
If none of the suggestions helped, try to install pip with a command that's specific to your operating system.
On Debian / Ubuntu
sudo apt update
sudo apt install python3-venv python3-pip
On MacOS
brew install python
On Fedora / CentOS
sudo dnf install python3-pip python3-wheel
Try upgrading pip by running:
on MacOS or Linux
python -m pip install --upgrade pip
for Python 3
python3 -m pip install --upgrade pip
on Windows
py -m pip install --upgrade pip
If the error persists, get your Python version and make sure you are installing the package using the correct Python version.
python --version
For example, my Python version is 3.10.4, so I would install the requests package with pip3.10 install requests.
pip3.10 install requests
if you get permissions error
sudo pip3.10 install requests
Notice that the version number corresponds to the version of Python I'm using.
If that didn't help and you're using a virtual environment, try recreating it.
deactivate
deactivate
remove the old virtual environment folder
rm -rf venv
initialize a new virtual environment
python3 -m venv venv
activate on Unix or MacOS
source venv/bin/activate
activate on Windows (cmd.exe)
venv\Scripts\activate.bat
activate on Windows (PowerShell)
venv\Scripts\Activate.ps1
install the modules in your requirements.txt file
pip install -r requirements.txt
Your virtual environment will use the version of Python that was used to create it.
This should work if your previous virtual environment didn't have pip installed for some reason.
If none of the suggestions helped on a Windows machine, try installing
pip from the directory where the pip.exe file is located.
First locate Python by running the following command using cmd:
for Windows
where python
or a specific version if you have multiple installed
where python3
Now open the Scripts folder and make sure it contains the pip.exe file.
Open your command prompt in the Scripts directory right next to the pip.exe file and run the following command.
pip install pip
py -m pip install --upgrade pip
If the error persists, I would suggest watching a quick video on how to set Python and pip in your PATH environment variable.
Ref. https://bobbyhadz.com/blog/python-no-module-named-pip
For some reason when I run pipenv install it tries to execute my Windows python.exe:
OSError: [Errno 8] Exec format error: '/mnt/c/Users/<MY_USER_NAME>/AppData/Local/
Microsoft/WindowsApps/python.exe'
I am running WSL Ubuntu 18.04. I have installed Pipenv with the following commands:
sudo apt install python3-pip
pip3 install --user pipenv
python3 -m site --user-base
Added ~/.local/bin to ~/.profile PATH, and then source ~/.profile
This worked for me:
pipenv install --python=/usr/bin/python3.6
Explanation: https://github.com/pypa/pipenv/issues/3488
The python version on Windows is higher than that on WSL, making it
come before the latter one..
Specify python path explicitly can fix the problem:
$ pipenv --python /usr/bin/python3
I'm having trouble installing packages using virtualenv with python. I do the following:
sudo virtualenv venv
cd venv/bin
source activate
pip install nose
I get the following error:
unable to execute /Users/../venv/bin/pip: No such file or directory
What am I doing wrong here?
run:
cd /usr/local/bin
sudo ./pip install virtualenv
which virtualenv
This should point to /usr/local/bin/virtualenv
which pip
This should point to /usr/local/bin/pip
virtualenv /Users/yourname/path/to/env/envname
I have python virtualenv and trying to install nodeenv it throws
"no python virtualenv is available"
inside my activated python virtual env with . bin/activate
I run the following commands
pip install nodeenv
nodeenv -p
And it throws the error... I'm currently trying to install less with django-compressor
This also happened to me, it's because nodeenv is not installed in your virtual environment. The following solved it for me:
sudo pip uninstall nodeenv
# Source your virtual environment.
source /path/to/virtualenv
pip install nodeenv
nodeenv -p
This happened to me on Mac OSX Yosemite.
I had installed nodeenv as a user. The solution was to install it as root:
pip uninstall nodeenv
sudo pip install nodeenv
# Source the virtual environment or use workon for virtualenvwrapper
workon <virtualenv name>
nodeenv -p
I am using Django 1.3.7 and python 2.7.6 on windows7
I got an error when I executing my manage.py in this line of code
import shutil, sys, virtualenv, subprocess
amd running it, I got this error
C:\Django-Proj\>python manage.py update_ve
Traceback (most recent call last):
File "manage.py", line 4, in <module>
import shutil, sys, virtualenv, subprocess
ImportError: No module named virtualenv
Does anyone have an Idea about my case?
Install virtualenv using pip install virtualenv.
If you have it already installed, try reinstalling it by removing it with pip uninstall virtualenv and then reinstalling it.
Good Luck.
I had to install virtualenv with the -H flag to set HOME variable to target user's home dir.
sudo -H pip install virtualenv
I think the problem is you need sudo to globally install virtualenv.
> pip install virtualenv
Could not find an activated virtualenv (required).
> sudo pip install virtualenv
Downloading/unpacking virtualenv
...
But this creates files readable only by root (depending on the umask).
In this case, uninstalling/reinstalling may not always help.
You can check with ls -la /usr/local/lib/python2.7/dist-packages/virtualenv.py (replacing 2.7 with whatever version you have or are targeting).
My solution was simply:
sudo chmod -R o+rX /usr/local/lib/python2.7
Use pip3 instead of pip. I had the same issue and pip3 worked for me.
$ pip3 install virtualenv
$ virtualenv venv --python=python3
Try
python3 -m pip uninstall virtualenv
python3 -m pip install virtualenv
I just ran into this same problem. I had to pip uninstall virtualenv as a user with admin rights, then pip install virtualenv as a normal user. I think it's some kind of permissions issue if you installed virtualenv under admin rights.
>virtualenv
ImportError: No module named 'virtualenv'
>pip uninstall virtualenv
PermissionError: [Errno 13] Permission denied:
>sudo pip uninstall virtualenv
Successfully uninstalled virtualenv-15.1.0
>pip install virtualenv
Collecting virtualenv
>virtualenv
Options:
Bingo!
I had the same problem when I created my virtualenv via pycharm and installed requirements with pycharm.
After trail and error , I found that installed requirements are not taken into account by the virtualenv.
The solution is to reinstall all requirements once you have activated your virtualenv:
venv\scripts\activate
python -m pip install -r YourRequirements.txt
Next time I'd better create my virtualenv directly with command line
Got this error when using the ansible pip module automating some pip installs on my localhost.
fatal: [localhost]: FAILED! => {"changed": false, "cmd": ["/opt/bin/virtualenv", "--system-site-packages", "-p/usr/bin/python3", "/opt/venv/myenv"], "msg": "\n:stderr: /usr/bin/python3: No module named virtualenv\n"}
Uninstalling virtualenv python3 -m pip uninstall virtualenv did show virtualenv was installed here /home/ubuntu/.local/bin/virtualenv.
In the ansible task specify the virtualenv_command:
- name: install requirements file
pip:
virtualenv_command: "/home/{{whoami.stdout}}/.local/bin/virtualenv"
virtualenv: "/home/{{whoami.stdout}}/.venv/{{item.env.virtualenv}}"
requirements: "/home/{{whoami.stdout}}/git/{{item.env.requirements_txt}}"
virtualenv_site_packages: yes
when: req_stat.stat.exists
For mac os the issue was with virtualenv. This is because the folder virtualenv did not exist.
This worked well
python3 -m venv env