1

I have the below setup.py script. When I execute the command setup.py install, I do not see the python packages installed in my system. In case of java, we use maven or gradle so that it can automatically download and install in the system. I want exact feature in setup.py. I see that colorama, configparser are not installed, I manually installed setuptools and cx-Freeze using pip command. Below is my setup.py script contents.

from setuptools import setup, find_packages, Command

setup(
    name="Runner",  # program name
    version="0.0.1",
    description='A utility to build an exe',
    author="Debadatta Mishra",
    author_email="[email protected]",
    python_requires='>=3.6',
    install_requires=['configparser==4.0.2', 'colorama==0.4.3', 'setuptools==45.2.0', 'cx-Freeze==6.1']
)

If I execute pip list, I do not see colorama, configparser etc. Please help me , I am new to python programming.

To run the setup script, I use the command python setup.py install in command prompt.

13
  • What is the ouput of the python setup.py install command ? Commented Feb 17, 2020 at 16:49
  • It runs without error but packages are not installed. Commented Feb 17, 2020 at 17:07
  • What is the output of pip -V ? Commented Feb 17, 2020 at 20:01
  • It is latest one ie. 20 Commented Feb 17, 2020 at 20:04
  • 1
    I'm not sure what you mean by "manually install all the packages". If you run pip install . in the directory your setup.py resides in, it will process all the dependencies from install_requires as well. This is the "correct" way to install Python packages these days, as pip is ostensibly independent of setuptools and the different ways it does things. Commented Feb 18, 2020 at 16:51

2 Answers 2

1

There is nothing wrong with your setup.py. There must be something wrong with your environment, because when your script is running in clean docker environment is works.

Create clean environment by using such a Dockerfile

FROM python:3.8.1-buster
RUN mkdir /debmis
ADD setup.py /debmis
WORKDIR /debmis
RUN python setup.py install
CMD /usr/bin/env pip list

Build it (having your setup.py in current directory):

docker build -t python3 .

And run

docker run python3

Package      Version
------------ -------
colorama     0.4.3  
configparser 4.0.2  
cx-Freeze    6.1    
pip          20.0.2 
Runner       0.0.1  
setuptools   45.1.0 
wheel        0.34.2

I suggest comparing difference between python setup.py install executed in your environment and executed by docker build.

Sign up to request clarification or add additional context in comments.

2 Comments

I am using simply in windows 10 not in dockerized container. even I do not want docker for a simple python project.
Sure, I suggested docker as cross-check tool only. To check whether the problem is in setup.py or whether it is outside. It is outside.
0

As suggested by @Iguananaut, if you have a setup.py and if it has install_requires with the mentioned python packages. You can use the below command in windows to install the python packages.

pip install -e .

As mentioned above .(dot) is required.

2 Comments

To be clear, this is true on any platform. I didn't say this in the comments, but might I also suggest instead of just pip to run python -m pip instead, where you can replace the "python" with the path/filename of the specific Python interpreter for which you want to install a package. A mistake many beginners make is they have multiple Python interpreters on their system, but the main pip executable is not associated with the Python they are trying to use, so they install packages for the wrong python. python -m pip ensures you're using the right pip for the right Python.
Thank you Mam for this suggestion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.