-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Add instructions how to activate virtual env under windows with pip #29113
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
Conversation
Contributing.rst now correctly describes how to setup dev environment under Windows Closes pandas-dev#29112
Hi @WillAyd , Regards |
@datapythonista mind taking a look here? |
# ~\virtualenvs\pandas-dev\scripts | ||
# Please refer to the official user guide at | ||
# https://virtualenv.pypa.io/en/stable/userguide/#activate-script | ||
# about how to activate your virtual environment under Windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying this @gbaychev.
Don't you think could be clearer to have the windows instructions in a separate block? Feels like there is too much information in this block now. And having two blocks would let users just read the one they care about, and have the information presented in a clearer way.
Feel free to disagree, but I think we can probably do better at communicating this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You guys are very careful and diplomatic, cheers for that :) Yes @datapythonista, you are absolutely correct, I've split the information into two code-blocks, please see 39f6fa7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused. Your previous diff was quite big, but if I'm not missing something, now the only difference is the activation. Is there something missing? If it's just that, just a single block makes more sense, and that line could simply be changing this in this PR:
. ~/virtualenvs/pandas-dev/bin/activate (~\virtualenvs\pandas-dev\Scripts\Activate.ps1 in Windows)
python -m pip install -r requirements-dev.txt | ||
|
||
# Build and install pandas | ||
python setup.py build_ext --inplace -j 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why we had -j 4
initially, but I think it's better -j auto
, so all cores are used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got confused, it's -j 0
- add aditional information about cmd.exe - use $env:Userprofile where appropriate - add --use-no-pep517 to the windows instruction - add some syntax highlight Relevant issue pandas-dev#29113
Alright I need to apologize - yesterday I was tired and I've committed some brain fart to the repo. Now I've added the info about cmd.exe in the comments in the Windows code-block. Also I did some more testing with powershell and I've adjusted the initial generation of the virtual env, so that it 100% functions. I've also added the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of small things, and you need to fix the CI (tailing whitespaces).
Should be good with that.
python -m pip install -r requirements-dev.txt | ||
|
||
# Build and install pandas | ||
python setup.py build_ext --inplace -j 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got confused, it's -j 0
- remove trailing spacing remove - change the setup.py params so that all CPU cores will be utilized - split cmd.exe instructions on a separate line Related issue pandas-dev#29112
Hello, I did the requested changes Regards |
# Use an ENV_DIR of your choice. We'll use ~\virtualenvs\pandas-dev where | ||
# '~' is the folder pointed to by either $env:USERPROFILE (Powershell) or | ||
# %USERPROFILE% (cmd.exe) environment variable | ||
# Any parent directories should already exist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move this outside of the code block, it'll be easier to read as a paragraph than as code comments.
Also, since you explain the equivalence of $env:USERPROFILE
and %USERPROFILE%
here, you can just leave one of them below. Will look much cleaner and clearer without duplicating the ocmmands.
Other than that, lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, @WillAyd do you want to have a look?
python -m venv $env:USERPROFILE\virtualenvs\pandas-dev | ||
|
||
# Activate the virtualenv. Use activate.bat for cmd.exe | ||
~\virtualenvs\pandas-dev\Scripts\Activate.ps1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that we use $env:USERPROFILE
in the previous command, and ~
here. Is this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is correct. Powershell on its own resolves the ' ~ ' to correctly to the home directory. But I noticed, that if I call python -m venv ~\virtualenvs\pandas-dev
, venv won't expand ' ~ ' to your home folder and will create a folder called '~' in your current working directory. Hence I've added $env:USERPROFILE, it is the only place where is really needed, if you are using powershell.
Since ' ~ ' is explained in the now extracted paragraph above, I think the snippet you've quoted can stay as it is.
Thanks @gbaychev |
Contributing.rst now correctly describes how to setup dev environment
under Windows when using pip and not conda.
Closes #29112
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff