Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'pip install' is extremely slow in WSL2 #6643

Closed
rpw138 opened this issue Mar 8, 2021 · 20 comments
Closed

'pip install' is extremely slow in WSL2 #6643

rpw138 opened this issue Mar 8, 2021 · 20 comments

Comments

@rpw138
Copy link

rpw138 commented Mar 8, 2021

Environment

WSL2: Linux version 5.4.72-microsoft-standard-WSL2 (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Oct 28 23:40:43 UTC 2020

Steps to reproduce

git clone https://github.com/NVlabs/stylegan2
cd stylegan2
docker build . -t stylegan2

Expected behavior

Pip install is very fast on wsl2: Download starts immediately and is very fast

Actual behavior

Pip during docker build is very slow on wsl2 - the install hangs when downloading scipy for ~5 to 10 minutes. Also noticed similar for google drive downloads.

@rpw138 rpw138 changed the title 'Pip Install' is extremely slow in WSL2 'pip install' is extremely slow in WSL2 Mar 8, 2021
@Bartdoekemeijer
Copy link

You may be a variant of the slow network in WSL2 issue

@therealkenc
Copy link
Collaborator

install hangs when downloading scipy for ~5 to 10 minutes.

Could be /dupe #4901 or #6365, or (depending on the uncited pwd) #4197

@ghost
Copy link

ghost commented Mar 8, 2021

Hi! We've identified this issue as a duplicate of another one that already exists in this repository. This specific instance is being closed in favor of tracking the concern over on the referenced thread.

Thanks for your report!

@ghost ghost closed this as completed Mar 8, 2021
@ghost ghost added the duplicate label Mar 8, 2021
@ceagan
Copy link

ceagan commented Aug 9, 2021

This is not due to a slow network issue. It takes 5-10 minutes to get past something, then the installations continue at a normal pace. Download speeds are fine once the installation of packages starts.

See On WSL2 pip install virtualenv comand hangs for too long on Stack Overflow.

@krshrimali
Copy link

krshrimali commented Oct 8, 2021

This is not due to a slow network issue. It takes 5-10 minutes to get past something, then the installations continue at a normal pace. Download speeds are fine once the installation of packages starts.

See On WSL2 pip install virtualenv comand hangs for too long on Stack Overflow.

Not 5-10 mins for me, but still significant waiting time. I installed Windows 11 today, and am facing this issue. Can someone please take a look?

Also, it's not the network issue, it just gets stuck for a couple of mins, and then starts installing with normal speed.

Please note that I'm using zsh (oh-my-zsh config) + anaconda for env (if this matters).

@ppaanngggg
Copy link

This is not due to a slow network issue. It takes 5-10 minutes to get past something, then the installations continue at a normal pace. Download speeds are fine once the installation of packages starts.

See On WSL2 pip install virtualenv comand hangs for too long on Stack Overflow.

thanks, solve my problem

@FlorinAndrei
Copy link

@ppaanngggg How did you solve it? That Stack Overflow page does not offer a solution.

@ppaanngggg
Copy link

@ppaanngggg How did you solve it? That Stack Overflow page does not offer a solution.

I use this command DISPLAY= pip install <packagename>

@francois-rozet
Copy link

I use this command DISPLAY= pip install <packagename>

IMHO, this is a great temporary fix, but not a good solution and the issue should be reopened.

I don't really understand the problems with keyrings and DISPLAY and X servers, but I think users should not have to play with them when installing Python packages. It should be as easy on WSL as on a true Linux OS.

@ppaanngggg
Copy link

I dont know, but it works.

I think it is a new problem after WSLg update for WSL2.

@ll7
Copy link

ll7 commented Feb 9, 2022

Where can I find more about the DISPLAY= command? It works, but I don't understand it.

@ceagan
Copy link

ceagan commented Feb 9, 2022

This command sets the environment variable DISPLAY to empty. If you are running an XServer, this environment variable enables apps to connect to the XServer to display graphical information. I don’t know the details, but presumably, pip is reading the environment variable and because it is set, it attempts to connect to the XServer and use a long timeout to do so. Since no XServer is running by default in WSL2, the connection to the server fails after awhile. Setting the environment variable to blank lets pip know that no XServer is available, so it skips trying to connect to it.

@flaccidattempts
Copy link

flaccidattempts commented May 18, 2022

If its any help for this topic.
This always happens after i mount from wsl2 to C drive [from wsl2] and use cmd 'python my_script.py'.

for example.... from desktop login..

winkey + x
a 

Powershell
wsl                        


bash

cd /mnt/c/Users/*/Desktop/Projects/python


python main.py

after exiting this windows terminal, python3-pip hangs super bad. Notably when invoking 'pip install'

@shivangsgangadia
Copy link

Was facing the same issue. However, I have XServer set up with XLaunch because I often use graphical apps. As pointed out by @ceagan , if this xserver host is running on windows, things work as fast as they should but when it is disabled, pip waits a long time for a timeout. I recommend setting up XLaunch because you might need it at some point in the future anyway.

@ntbanks
Copy link

ntbanks commented Jul 13, 2022

I've seen mixed reviews on this but i moved my project from the C mount /mnt/c/Users/*/Documents.... to the actual linux file system /home/*/.... and it fixed the slow install times.

@amrohendawi
Copy link

Instead of adding DISPLAY= every time to your commands, just install a GUI for WSL2 like GWSL.

@tafia
Copy link

tafia commented Nov 4, 2022

Isn't updating .bash_aliases enough?
something like

alias pip="DISPLAY= pip"

@bat52
Copy link

bat52 commented Jan 12, 2023

WSL2 is much slower than WSL1 when accessing files on the windows filesystem, according to what mentioned here
https://stackoverflow.com/questions/68972448/why-is-wsl-extremely-slow-when-compared-with-native-windows-npm-yarn-processing

@Anutrix
Copy link

Anutrix commented Apr 2, 2023

Still facing this issue on latest version of WSL2.

I have max network speed in WSL2(pip works fine) but python -m venv venv-name is super slow so it doesn't seem network related.

@BramVanroy
Copy link

I found that my installation was very slow, too, but using the -v option it seems to hang especially at the end of the installation when it is changing the permissions for installed entrypoints. For instance, if you have tensorboard or streamlit or something like that that you can call from the command-line like streamlit run ..., such binaries are modified.

changing mode of /mnt/f/python/.venv/bin/google-oauthlib-tool to 777
changing mode of /mnt/f/python/.venv/bin/tensorboard to 777
changing mode of /mnt/f/python/.venv/bin/streamlit to 777

This takes quite a long time, at least when using /mnt/ drive. That being said, setting DISPLAY= pip install ... already made things quite a bit faster.

domq pushed a commit to epfl-si/sddc-ocp that referenced this issue Nov 20, 2023
lelouchviesp pushed a commit to epfl-si/sddc-ocp that referenced this issue Nov 20, 2023
lelouchviesp pushed a commit to epfl-si/sddc-ocp that referenced this issue Jan 31, 2024
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests