Python Forum
Error during `python setup.py develop` and `pip install -r requirements.txt`
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error during `python setup.py develop` and `pip install -r requirements.txt`
#1
I'm encountering an issue while trying to install the dependencies for my Python project using setup.py and pip install -r requirements.txt in Windows Powershell.

Here's my setup.py:
import setuptools

with open("README.md","r") as fh:
    long_description = fh.read()
    
setuptools.setup(
    name = "titanic-prediction",
    version = "0.0.1",
    author = "author",
    author_email = "[email protected]",
    description = "simple repo for exercise",
    long_description = "long_description",
    long_description_content_type = "text/markdown",
    url = "",
    packages = setuptools.find_packages(),
    classifiers = ["Programming Language :: Python :: 3"],
    install_requires = [
        "matplotlib",
        "numpy",
        "pandas == 1.1.4",
        "scikit-learn == 0.22", #(>= 3.5)
        "seaborn == 0.11.0"],
    python_requires = ">=3.7"
)
and this is my requirements.txt:
matplotlib
numpy
pandas==1.1.4
pydantic==1.6.1
scikit-learn
seaborn==0.11.0
Then I try to run python setup.py develop in Windows Powershell, but I got this error:
Error:
running develop D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\command\develop.py:41: EasyInstallDeprecationWarning: easy_install command is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` and ``easy_install``. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://github.com/pypa/setuptools/issues/917 for details. ******************************************************************************** !! easy_install.initialize_options(self) D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` directly. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details. ******************************************************************************** !! self.initialize_options() running egg_info writing titanic_prediction.egg-info\PKG-INFO writing dependency_links to titanic_prediction.egg-info\dependency_links.txt writing requirements to titanic_prediction.egg-info\requires.txt writing top-level names to titanic_prediction.egg-info\top_level.txt reading manifest file 'titanic_prediction.egg-info\SOURCES.txt' writing manifest file 'titanic_prediction.egg-info\SOURCES.txt' running build_ext Creating d:\data analyst\github\lokalhangatt\pacmann - git\minggu_4\4. advanced data manipulation\pertemuan 8 - data preprocessing pipeline\virenv_preprocessing\lib\site-packages\titanic-prediction.egg-link (link to .) titanic-prediction 0.0.1 is already the active version in easy-install.pth Installed d:\data analyst\github\lokalhangatt\pacmann - git\minggu_4\4. advanced data manipulation\pertemuan 8 - data preprocessing pipeline\virenv_preprocessing\simple_pipeline Processing dependencies for titanic-prediction==0.0.1 Searching for scikit-learn==0.22 Reading https://pypi.org/simple/scikit-learn/ Downloading https://files.pythonhosted.org/packages/4f/2c/04e10167991ed6209fb251a212ca7c3148006f335f4aadf1808db2cbeda8/scikit-learn-0.22.tar.gz#sha256=314abf60c073c48a1e95feaae9f3ca47a2139bd77cebb5b877c23a45c9e03012 Best match: scikit-learn 0.22 Processing scikit-learn-0.22.tar.gz Writing C:\Users\ADMINI~1\AppData\Local\Temp\easy_install-dxw9q95a\scikit-learn-0.22\setup.cfg Running scikit-learn-0.22\setup.py -q bdist_egg --dist-dir C:\Users\ADMINI~1\AppData\Local\Temp\easy_install-dxw9q95a\scikit-learn-0.22\egg-dist-tmp-a2evsbeb C:\Users\ADMINI~1\AppData\Local\Temp\easy_install-dxw9q95a\scikit-learn-0.22\setup.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html from pkg_resources import parse_version Partial import of sklearn during the build process. Traceback (most recent call last): File "C:\Users\ADMINI~1\AppData\Local\Temp\easy_install-dxw9q95a\scikit-learn-0.22\setup.py", line 195, in check_package_status module = importlib.import_module(package) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python312\Lib\importlib\__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked ModuleNotFoundError: No module named 'numpy' Traceback (most recent call last): File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\sandbox.py", line 167, in save_modules yield saved File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\sandbox.py", line 209, in setup_context yield File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\sandbox.py", line 270, in run_setup _execfile(setup_script, ns) File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\sandbox.py", line 52, in _execfile exec(code, globals, locals) File "C:\Users\ADMINI~1\AppData\Local\Temp\easy_install-dxw9q95a\scikit-learn-0.22\setup.py", line 303, in <module> File "C:\Users\ADMINI~1\AppData\Local\Temp\easy_install-dxw9q95a\scikit-learn-0.22\setup.py", line 291, in setup_package File "C:\Users\ADMINI~1\AppData\Local\Temp\easy_install-dxw9q95a\scikit-learn-0.22\setup.py", line 219, in check_package_status ImportError: numpy is not installed. scikit-learn requires numpy >= 1.11.0. Installation instructions are available on the scikit-learn website: http://scikit-learn.org/stable/install.html During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\simple_pipeline\setup.py", line 6, in <module> setuptools.setup( File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\__init__.py", line 117, in setup return distutils.core.setup(**attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\_distutils\core.py", line 183, in setup return run_commands(dist) ^^^^^^^^^^^^^^^^^^ File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\_distutils\core.py", line 199, in run_commands dist.run_commands() File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\_distutils\dist.py", line 954, in run_commands self.run_command(cmd) File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\dist.py", line 995, in run_command super().run_command(command) File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\_distutils\dist.py", line 973, in run_command cmd_obj.run() File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\command\develop.py", line 35, in run self.install_for_development() File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\command\develop.py", line 127, in install_for_development self.process_distribution(None, self.dist, not self.no_deps) File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\command\easy_install.py", line 788, in process_distribution distros = WorkingSet([]).resolve( ^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\pkg_resources\__init__.py", line 892, in resolve dist = self._resolve_dist( ^^^^^^^^^^^^^^^^^^^ File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\pkg_resources\__init__.py", line 928, in _resolve_dist dist = best[req.key] = env.best_match( ^^^^^^^^^^^^^^^ File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\pkg_resources\__init__.py", line 1266, in best_match return self.obtain(req, installer) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\pkg_resources\__init__.py", line 1302, in obtain return installer(requirement) if installer else None ^^^^^^^^^^^^^^^^^^^^^^ File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\command\easy_install.py", line 710, in easy_install return self.install_item(spec, dist.location, tmpdir, deps) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\command\easy_install.py", line 737, in install_item dists = self.install_eggs(spec, download, tmpdir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\command\easy_install.py", line 934, in install_eggs return self.build_and_install(setup_script, setup_base) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\command\easy_install.py", line 1206, in build_and_install self.run_setup(setup_script, setup_base, args) File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\command\easy_install.py", line 1192, in run_setup run_setup(setup_script, args) File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\sandbox.py", line 260, in run_setup with setup_context(setup_dir): File "C:\Program Files\Python312\Lib\contextlib.py", line 158, in __exit__ self.gen.throw(value) File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\sandbox.py", line 201, in setup_context with save_modules(): File "C:\Program Files\Python312\Lib\contextlib.py", line 158, in __exit__ self.gen.throw(value) File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\sandbox.py", line 180, in save_modules saved_exc.resume() File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\sandbox.py", line 154, in resume raise exc.with_traceback(self._tb) File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\sandbox.py", line 167, in save_modules yield saved File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\sandbox.py", line 209, in setup_context yield File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\sandbox.py", line 270, in run_setup _execfile(setup_script, ns) File "D:\Data Analyst\Github\lokalhangatt\Pacmann - Git\Minggu_4\4. ADVANCED DATA MANIPULATION\Pertemuan 8 - Data Preprocessing Pipeline\virenv_preprocessing\Lib\site-packages\setuptools\sandbox.py", line 52, in _execfile exec(code, globals, locals) File "C:\Users\ADMINI~1\AppData\Local\Temp\easy_install-dxw9q95a\scikit-learn-0.22\setup.py", line 303, in <module> File "C:\Users\ADMINI~1\AppData\Local\Temp\easy_install-dxw9q95a\scikit-learn-0.22\setup.py", line 291, in setup_package File "C:\Users\ADMINI~1\AppData\Local\Temp\easy_install-dxw9q95a\scikit-learn-0.22\setup.py", line 219, in check_package_status ImportError: numpy is not installed. scikit-learn requires numpy >= 1.11.0. Installation instructions are available on the scikit-learn website: http://scikit-learn.org/stable/install.html
Then when I try to run requirements.txt, it shows an error like this
[Image: iwZCQD.jpg]:
Error:
ERROR: Invalid requirement: '–r': Expected package name at the start of dependency specifier –r ^
Are there any mistakes in my setup.py or requirements.txt files? And how to solve it?
Reply
#2
requirements.txt is not 'run' it is a text file that contains module names, and used as an attribute to pip command:
pip install -r requirements.txt.

But, instead, from command line, you need to install numpy: pip install numpy. which is the missing module.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020