Of course! The command you're looking for is almost certainly python setup.py install, but there's a much better, modern alternative.
Let's break it down.
The Old Way: python setup.py install
This is the traditional way to install a Python package from source code that you've downloaded.
How it Works
- A package contains a file named
setup.py. This is a Python script that contains metadata about the package (its name, version, author, dependencies, etc.) and instructions on how to build and install it. - When you run
python setup.py install, you are telling Python to execute this script. - The script then builds the package and installs its files into your Python environment's
site-packagesdirectory.
When to Use It
You should only use this method in specific situations:
- Installing from a source download: You've downloaded a
.tar.gzor.zipfile from a source repository (like PyPI or a GitHubreleasespage) and it doesn't have apyproject.tomlfile. - Legacy systems: You are working on an old project or system that doesn't support modern packaging tools.
- Development: You are actively developing a package and want to install it in "editable" mode (
python setup.py develop), though even this is now superseded bypip install -e ..
⚠️ Important Problems with python setup.py install
- It's Outdated: The
setuptoolslibrary, whichsetup.pyrelies on, has been superseded by more modern standards like PEP 517 and PEP 518. These new standards use apyproject.tomlfile instead ofsetup.py. - It Breaks Environments: This command installs packages directly into your system's global Python site-packages. This is a bad practice because it can lead to dependency conflicts between different projects.
- It Ignores Virtual Environments: If you have a virtual environment active, it might still try to install to the global location, bypassing the environment entirely.
- It Doesn't Handle Dependencies Well: It doesn't automatically fetch and install the package's dependencies (you have to do that manually).
The Modern & Correct Way: pip install .
The standard and recommended way to install a package (from a local directory or a source archive) is by using pip.

How it Works
- You navigate your terminal to the root directory of the package you want to install (the directory that contains
setup.pyorpyproject.toml). - You run
pip install .(the tells pip to install the package from the current directory). pipis smart. It will detect the build system (either the oldsetuptoolsor the newbuildstandard) and build the package correctly.- It then installs the package into the currently active Python environment.
When to Use It
This is the default command you should use for almost every scenario:
- Installing a package you've cloned from GitHub.
- Installing a package from a local source code directory.
- Installing a package from a downloaded
.tar.gzor.zipfile (you can pointpipdirectly to the file:pip install /path/to/package-1.0.tar.gz).
Advantages over python setup.py install
- Environment-Aware: It correctly installs into your active virtual environment, preventing global pollution.
- Handles Dependencies: It automatically reads the package's dependencies from
setup.pyorpyproject.tomland installs them first. - Future-Proof: It works with both old (
setup.py) and new (pyproject.toml) packaging standards. - Standard Practice: This is the community-accepted, modern way to do it.
Summary: python setup.py install vs. pip install .
| Feature | python setup.py install (Old Way) |
pip install . (Modern Way) |
|---|---|---|
| Primary Tool | setuptools script |
pip (Python's Package Installer) |
| Installation Target | Often global, can ignore virtual environments | Correctly targets the active virtual environment |
| Dependency Handling | Manual; requires user to install dependencies first | Automatic; reads and installs dependencies |
| Standards | Outdated (setuptools-only) |
Supports both old (setup.py) and new (pyproject.toml) |
| Recommendation | Avoid. Use only for legacy systems or specific source archives. | Highly Recommended. The standard for all modern Python projects. |
Step-by-Step Example (The Modern Way)
Let's say you want to install a package called requests directly from its GitHub source code.
-
Clone the repository:

git clone https://github.com/psf/requests.git
-
Navigate into the project directory:
cd requests
(You'll see files like
setup.py,pyproject.toml,README.rst, etc.) -
(Recommended) Create and activate a virtual environment: This isolates the package's dependencies from your system's Python.

# Create the environment python -m venv .venv # Activate it (the command differs for OS) # On macOS/Linux: source .venv/bin/activate # On Windows: .venv\Scripts\activate
Your terminal prompt should now change to show
(.venv). -
Install the package using pip:
pip install .
You will see output from
pipas it builds the package and installs it, along with its dependencies likecharset-normalizer,idna, andurllib3, into your.venvenvironment.
You have now successfully and correctly installed the package!
