python - setup.py sdist bdist_wheel

10,990

The scripts parameter of setuptools.setup function should be a list of filenames. So in your case I believe it should read:

setuptools.setup(
    # ...
    scripts=['nsmpy.py'],
    # ...
)

Also note that the scripts parameter has somewhat fallen out of favor. It is nowadays recommended to use console_scripts entry points instead, for which there is much more up-to-date documentation available.

References:

Share:
10,990
sinoroc
Author by

sinoroc

Updated on June 27, 2022

Comments

  • sinoroc
    sinoroc almost 2 years

    I decided to create a small little module named "NsmPY". Once I had finished the code behind the module (available on GitHub), I got to work trying to upload this new module to PyPi. However, when I ran the necessary command python3 setup.py sdist bdist_wheel, the program spat out an error:

    running sdist
    running egg_info
    writing nsmpy.egg-info\PKG-INFO
    writing dependency_links to nsmpy.egg-info\dependency_links.txt
    writing top-level names to nsmpy.egg-info\top_level.txt
    reading manifest file 'nsmpy.egg-info\SOURCES.txt'
    writing manifest file 'nsmpy.egg-info\SOURCES.txt'
    warning: sdist: standard file not found: should have one of README, README.rst, README.txt, README.md
    
    running check
    creating nsmpy-1.0
    creating nsmpy-1.0\nsmpy.egg-info
    copying files to nsmpy-1.0...
    copying setup.cfg -> nsmpy-1.0
    copying setup.py -> nsmpy-1.0
    copying nsmpy.egg-info\PKG-INFO -> nsmpy-1.0\nsmpy.egg-info
    copying nsmpy.egg-info\SOURCES.txt -> nsmpy-1.0\nsmpy.egg-info
    copying nsmpy.egg-info\dependency_links.txt -> nsmpy-1.0\nsmpy.egg-info
    copying nsmpy.egg-info\top_level.txt -> nsmpy-1.0\nsmpy.egg-info
    Writing nsmpy-1.0\setup.cfg
    Creating tar archive
    removing 'nsmpy-1.0' (and everything under it)
    running bdist_wheel
    running build
    running build_scripts
    creating build
    creating build\scripts-3.7
    error: [Errno 2] No such file or directory: 'nsmpy'
    

    However, in my code there is absolutely no mention of the file or directory 'nsmpy', and even so, the code, setup.py, setup.cfg and all other setup files are all stored in the folder 'nsmpy'.

    Furthermore, when I finally did upload this to my account on PyPi (I ran python setup.py sdist) it did work - until I actually decided to install the module with pip install nsmpy, it gave me the following errors:

    Collecting nsmpy==1.0.0
      Using cached nsmpy-1.0.tar.gz (628 bytes)
    Building wheels for collected packages: nsmpy
      Building wheel for nsmpy (setup.py) ... error
      ERROR: Command errored out with exit status 1:
       command: 'c:\users\sciencepi\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\SCIENC~1\\AppData\\Local\\Temp\\pip-install-98ihityv\\nsmpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\SCIENC~1\\AppData\\Local\\Temp\\pip-install-98ihityv\\nsmpy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\SCIENC~1\AppData\Local\Temp\pip-wheel-mm6p5lwl'
           cwd: C:\Users\SCIENC~1\AppData\Local\Temp\pip-install-98ihityv\nsmpy\
      Complete output (6 lines):
      running bdist_wheel
      running build
      running build_scripts
      creating build
      creating build\scripts-3.7
      error: [Errno 2] No such file or directory: 'nsmpy'
      ----------------------------------------
      ERROR: Failed building wheel for nsmpy
      Running setup.py clean for nsmpy
    Failed to build nsmpy
    ERROR: Error checking for conflicts.
    Traceback (most recent call last):
      File "c:\users\sciencepi\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3021, in _dep_map
        return self.__dep_map
      File "c:\users\sciencepi\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2815, in __getattr__
        raise AttributeError(attr)
    AttributeError: _DistInfoDistribution__dep_map
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "c:\users\sciencepi\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3012, in _parsed_pkg_info
        return self._pkg_info
      File "c:\users\sciencepi\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2815, in __getattr__
        raise AttributeError(attr)
    AttributeError: _pkg_info
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "c:\users\sciencepi\anaconda3\lib\site-packages\pip\_internal\commands\install.py", line 517, in _warn_about_conflicts
        package_set, _dep_info = check_install_conflicts(to_install)
      File "c:\users\sciencepi\anaconda3\lib\site-packages\pip\_internal\operations\check.py", line 114, in check_install_conflicts
        package_set, _ = create_package_set_from_installed()
      File "c:\users\sciencepi\anaconda3\lib\site-packages\pip\_internal\operations\check.py", line 53, in create_package_set_from_installed
        package_set[name] = PackageDetails(dist.version, dist.requires())
      File "c:\users\sciencepi\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2736, in requires
        dm = self._dep_map
      File "c:\users\sciencepi\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3023, in _dep_map
        self.__dep_map = self._compute_dependencies()
      File "c:\users\sciencepi\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3032, in _compute_dependencies
        for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
      File "c:\users\sciencepi\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3014, in _parsed_pkg_info
        metadata = self.get_metadata(self.PKG_INFO)
      File "c:\users\sciencepi\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1420, in get_metadata
        value = self._get(path)
      File "c:\users\sciencepi\anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1616, in _get
        with open(path, 'rb') as stream:
    PermissionError: [Errno 13] Permission denied: 'c:\\users\\sciencepi\\anaconda3\\lib\\site-packages\\tensorflow-2.1.0.dist-info\\METADATA'
    Installing collected packages: nsmpy
        Running setup.py install for nsmpy ... error
        ERROR: Command errored out with exit status 1:
         command: 'c:\users\sciencepi\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\SCIENC~1\\AppData\\Local\\Temp\\pip-install-98ihityv\\nsmpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\SCIENC~1\\AppData\\Local\\Temp\\pip-install-98ihityv\\nsmpy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\SCIENC~1\AppData\Local\Temp\pip-record-9ap1k2wf\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\sciencepi\anaconda3\Include\nsmpy'
             cwd: C:\Users\SCIENC~1\AppData\Local\Temp\pip-install-98ihityv\nsmpy\
        Complete output (6 lines):
        running install
        running build
        running build_scripts
        creating build
        creating build\scripts-3.7
        error: file 'C:\Users\SCIENC~1\AppData\Local\Temp\pip-install-98ihityv\nsmpy\nsmpy' does not exist
        ----------------------------------------
    ERROR: Command errored out with exit status 1: 'c:\users\sciencepi\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\SCIENC~1\\AppData\\Local\\Temp\\pip-install-98ihityv\\nsmpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\SCIENC~1\\AppData\\Local\\Temp\\pip-install-98ihityv\\nsmpy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\SCIENC~1\AppData\Local\Temp\pip-record-9ap1k2wf\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\sciencepi\anaconda3\Include\nsmpy' Check the logs for full command output.
    

    And yes, I am using the latest modules and latest versions of everything.

    from setuptools import setup
    
    setup(
        name="nsmpy",
        version="1.0.0",
        scripts=['nsmpy'])
    
    
    • sinoroc
      sinoroc about 4 years
      How does the setup.py file looks like?
    • Admin
      Admin about 4 years
      honestly, some people just dislike posts because they can; this is an issue stackoverflow needs to sort out.
    • sinoroc
      sinoroc about 4 years
      I downvoted, because in short: the question has not much value to the larger community, it only helps solving one particular issue, that barely anyone else is likely to have (since it's a typo), and if they did they would be unlikely to find this post from a search engine. Downvotes should not be seen as a punishment, often they just mean the question (and their answers) are unlikely to help anyone else.
    • Admin
      Admin about 4 years
      in which case >90% of all questions on this site would have a vote rating of -20. Also, this was not a typo, and I feel quite strongly that every post has a purpose, thus people with this problem are likely to get help from this post. When you downvote, it makes the post less accessible to those who need it.
    • Admin
      Admin about 4 years
      Well, another issue with your comment is that stackoverflow is a website for solving issues.
    • Admin
      Admin about 4 years
      The entire point of a question, no matter how insignificant, is to help whomever asked it, and to help those with a similar issue. This question also was not poorly researched, the reason I asked it was because I had done the research and there were no other instances of this error. Therefore your comment is not valid and will be flagged.
    • sinoroc
      sinoroc about 4 years
      Same root issue, different symptoms: stackoverflow.com/a/61531367/11138259
    • Zobayer Hasan
      Zobayer Hasan almost 4 years
      We should not down-vote a question based on whether there is a value for it or not. SO is often a place where we can find even the most niche scenarios. I would, however, down-voted it because it says nothing in the title. SO has a field for tags.