Skip to content

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

Merged
merged 7 commits into from
Nov 1, 2019

Conversation

gbaychev
Copy link
Contributor

Contributing.rst now correctly describes how to setup dev environment
under Windows when using pip and not conda.

Closes #29112

Contributing.rst now correctly describes how to setup dev environment
under Windows

Closes pandas-dev#29112
@WillAyd WillAyd added the Docs label Oct 22, 2019
@WillAyd WillAyd added this to the 1.0 milestone Oct 22, 2019
@gbaychev
Copy link
Contributor Author

Hi @WillAyd ,
I've adjusted the comments as discussed above, please take a look when it is convenient to you

Regards

@WillAyd
Copy link
Member

WillAyd commented Oct 24, 2019

@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
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

@datapythonista datapythonista left a 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
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least under Windows you need to use an integer for -j, 4 is a good value IMHO.

Capture

Copy link
Member

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
@gbaychev
Copy link
Contributor Author

Alright I need to apologize - yesterday I was tired and I've committed some brain fart to the repo.
What was missing was the information about the cmd.exe. Under Windows you can use two shells (WSL is a whole other story) - cmd.exe and powershell and they behave quite differently.

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 --no-use-pep517 argument to the Windows instructions, because it seems that under Windows a pep517 build gets triggered always. At least on the three different machines, I've tested with. Please see #28633

Copy link
Member

@datapythonista datapythonista left a 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
Copy link
Member

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
@gbaychev
Copy link
Contributor Author

gbaychev commented Nov 1, 2019

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
Copy link
Member

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

Copy link
Member

@datapythonista datapythonista left a 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
Copy link
Member

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?

Copy link
Contributor Author

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.

@WillAyd WillAyd merged commit 0de9955 into pandas-dev:master Nov 1, 2019
@WillAyd
Copy link
Member

WillAyd commented Nov 1, 2019

Thanks @gbaychev

Reksbril pushed a commit to Reksbril/pandas that referenced this pull request Nov 18, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: the description of activating virtual env with pip under windows is not correct
3 participants