5

Right now I'm trying to install python (3.10) and all further installations on my new pc (windows 10) and so far everything is set up:

  • Python installed
  • Windows paths for "Python" & "Python\Scrips"

I am able to call the python and pip version and also install some packages. But after installing virtualenv and creating one the - at the moment - unfixable error appears: I am unable to install packages into the pip-path of the virtualenviroment itself. Whenever I'm trying to run any pip-command I'm getting the following error:

Unable to create process using 'C:\Users\ExampleUser\AppData\Local\Programs\Python\Python310\python.exe "C:\folder\env\Scripts\pip.exe" '

As you can see, it's always refering to the original python-path, but on the other hand it's refering to the pip-path of the virtualenv!? Don't know if it's helpful, but when typing in where python and where pip the paths inside the venv are the first one listed. I've also watched out for no blank spaces in my path...

Unfortunately no explanation out there could help me until now and I never faced this problem on my old machine - mostly the same, except some older version of python, pip and virtualenv.

Does anyone else has an idea what I am missing?

vvvvv
  • 25,404
  • 19
  • 49
  • 81
finethen
  • 385
  • 1
  • 4
  • 19
  • 1
    What exact sequence of commands, including the one to create the virtualenv, leads to that error? – Code-Apprentice Feb 11 '22 at 23:40
  • 1. "virtualenv env", 2. ".\Scripts\Activate.ps1", 3. "pip install something..." – finethen Feb 12 '22 at 00:23
  • Is the actual "ExampleUser" folder name has a space? If so see if [this](https://stackoverflow.com/questions/71039131) solves your problem. I think `virtualenv` does run `venv` in the background. – kesh Feb 12 '22 at 02:46
  • No, there is no space in the entire path! Many mentioned that this might cause this problem, so I especially watched out for it. – finethen Feb 12 '22 at 09:24
  • 2
    @finethen Please [edit] your question to include those steps. – Code-Apprentice Feb 14 '22 at 16:54
  • Please show in your question, the actual steps / commands that you have run; and when sensible the full (error) outputs. How did you install virtualenv? How did you create the virtual environments? And so on. Do this the best you can, the most detailed you can so that we can try and reproduce your issue. – sinoroc Feb 26 '22 at 14:29
  • @finethen What happens if you do `python -m pip install something`? – a_guest Feb 26 '22 at 18:44
  • Are you using the basic Python installation or Anaconda? Because the virtual environment steps are a little different. I just setup a virtual environment in Anaconda and it works great with different libraries backing the math libraries. Because I'm compiling modules for import, they HAVE to be separated... All on Windows 10 so I may be able to help. If it's `venv` backed I have 2 PCs with environments setup already, and the initial steps can be a bit painful... – Matt Feb 27 '22 at 02:17
  • Been using the python installation but will give anaconda a try. – finethen Feb 27 '22 at 09:19
  • had a similar issue, try to install pyenv like I described here: https://stackoverflow.com/a/67986712/14096211 – nohehf Feb 27 '22 at 13:29

7 Answers7

1
  1. downloading Python 3 at the official website and installing it via express installation
  2. Copy & Paste the standalone python into the /python folder and overwriting the python version
  3. running python -m pip install --upgrade pip in cmd

Now pip and python 3 are installed in their latest version.

It's work for me

1

Could you use venv to create your virtual environment, instead of virtualenv (given that venv is the recommended way to create virtual environments for Python 3.3, and newer)?

If using venv is an option, this procedure may give you some idea on how to do it.

I have not done any Python development on Windows, but I think the basics would be:

python3 -m venv your-env-directory
your-env-directory\Scripts\activate.bat

If using venv is not an option, maybe you can try specifying the -v flag when running your virtualenv command to increase verbosity so you can further troubleshoot what's going on.

Cameron
  • 53
  • 10
  • Already tried using venv instead of virtualenv - unfortunately no change here! – finethen Feb 26 '22 at 08:35
  • Can you list the commands you used to set it up your virtual environment using `venv`? I assume you activated the virtual environment (i.e. ran the activate script) after creating it, right? – Cameron Feb 26 '22 at 14:04
0

try upgrade pip version python -m pip install --upgrade pip

Hmdo
  • 1
  • 2
0

[ Sorry if this answer turns out to be more of a comment than an answer. I only have 21 reputation, so I cannot comment ]

When trying to install pip packages and run python files, is the CWD (Current Working Directory) C:\folder\env\Scripts? If so, try chaning your CWD to C:\folder. I had a similar problem and doing this fixed it.

montw
  • 85
  • 10
0

You may need to look into a cygwin environment, and look into a chroot or jail environment to run the application without conflict.

0

Have you tried to use virtualenv-wrapper-win module. It helps me a lot to manage virtual envs

alebychac
  • 11
  • 4
0

Life is much easier using Anaconda 3 (it's definitely bloated compared to normal Python though), or use the minimal Miniconda (barebone install, basically just Python + a package manager). You can download it here: https://docs.conda.io/en/latest/miniconda.html#windows-installers Then you can make a new virtual environment super easy:

conda create -n myenv pip
conda activate

If you have multiple environments you do: conda activate [environment_name]

Now you're in your new environment with pip installed. And you get drop down menus in the Windows menu to get to your new environment too, so there isn't any searching required. They just appear. Now if you want to link Jupyter Notebook or Spyder to the installation, it takes more steps since you need more packages. I used this guide which basically activates Jupyter first, then Spyder IDE. https://medium.com/@apremgeorge/using-conda-python-environments-with-spyder-ide-and-jupyter-notebooks-in-windows-4e0a905aaac5

Since you created the environment with pip added you can pip install whatever packages you need. I had to do this recently with OpenBLAS backed NumPy and SciPy (the defaults from pip, not from conda). Now Miniconda is the closest thing to basic Python installation, and comes with some nice tools to make your life easier. Hopefully this is helpful.

Matt
  • 2,602
  • 13
  • 36