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
33 changes: 32 additions & 1 deletion doc/source/development/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,15 @@ Creating a Python environment (pip)
If you aren't using conda for your development environment, follow these instructions.
You'll need to have at least python3.5 installed on your system.

.. code-block:: none
**Unix**/**Mac OS**

.. code-block:: bash

# Create a virtual environment
# Use an ENV_DIR of your choice. We'll use ~/virtualenvs/pandas-dev
# Any parent directories should already exist
python3 -m venv ~/virtualenvs/pandas-dev

# Activate the virtualenv
. ~/virtualenvs/pandas-dev/bin/activate

Expand All @@ -254,6 +257,34 @@ You'll need to have at least python3.5 installed on your system.
python setup.py build_ext --inplace -j 4
python -m pip install -e . --no-build-isolation

**Windows**

Below is a brief overview on how to set-up a virtual environment with Powershell
under Windows. For details please refer to the
`official virtualenv user guide <https://virtualenv.pypa.io/en/stable/userguide/#activate-script>`__

.. code-block:: powershell

# Create a virtual environment
# 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


# If you are using cmd.exe, run instead: python -m venv $env:USERPROFILE\virtualenvs\pandas-dev
python -m venv $env:USERPROFILE\virtualenvs\pandas-dev

# Activate the virtualenv
# If you are using cmd.exe, run instead: %USERPROFILE%\virtualenvs\pandas-dev\Scripts\activate.bat
~\virtualenvs\pandas-dev\Scripts\Activate.ps1

# Install the build dependencies
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

python -m pip install -e . --no-build-isolation --no-use-pep517

Creating a branch
-----------------

Expand Down