PyPI: Problems uploading a module

Question:

I am trying to upload a python module to PyPI using setuptools and twine. My module can be seen at https://pypi.org/project/mousecontroller/. If you try installing the module using pip install mousecontroller, you will encounter an error:

Collecting mousecontroller
  Using cached mousecontroller-1.0.2.tar.gz (1.4 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: pypiwin32 in c:usersmeappdatalocalpackagespythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0localcachelocal-packagespython39site-packa
ges (from mousecontroller) (223)
Requirement already satisfied: keyboard in c:usersmeappdatalocalpackagespythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0localcachelocal-packagespython39site-packag
es (from mousecontroller) (0.13.5)
Requirement already satisfied: pywin32>=223 in c:usersmeappdatalocalpackagespythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0localcachelocal-packagespython39site-pa
ckages (from pypiwin32->mousecontroller) (304)
Building wheels for collected packages: mousecontroller
  Building wheel for mousecontroller (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      running bdist_wheel
      running build
      running build_scripts
      creating build
      creating buildscripts-3.9
      error: [Errno 2] No such file or directory: 'm'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mousecontroller
  Running setup.py clean for mousecontroller
Failed to build mousecontroller
Installing collected packages: mousecontroller
  Running setup.py install for mousecontroller ... error
  error: subprocess-exited-with-error

  × Running setup.py install for mousecontroller did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      running install
      C:UsersmeAppDataLocalPackagesPythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0LocalCachelocal-packagesPython39site-packagessetuptoolscommandinstall.py:34:
SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_scripts
      creating build
      creating buildscripts-3.9
      error: file 'C:UsersmeAppDataLocalTemppip-install-60u406ebmousecontroller_e9ecf1693b5a49f6aa898bb92d39281am' does not exist
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> mousecontroller

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

I have done some research on this problem and still have not found anything relevant to me or how to fix this. Here is my setup.py file:

from setuptools import setup, find_packages

setup(
    name='mousecontroller',
    version='1.0.2',
    author='(my name)',
    author_email='(my e-mail)',
    packages=find_packages(),
    url='https://pypi.org/project/mousecontroller/',
    license='LICENSE',
    description='A python package to easily control the mouse in realistic and fluent ways.',
    long_description=open('README.md', 'r').read(),
    long_description_content_type="text/markdown",
    scripts='mousecontroller.py',
    install_requires=['pypiwin32', 'keyboard'],
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
)

note: I have edited the code and log to protect some of my personal information.

Asked By: Freddie Rayner

||

Answers:

Your script= line is not correct, see the docs:

The scripts option simply is a list of files

You only provided your script as a string, which is split into individual characters when treated as a list. That is why the error message says that C:UsersmeAppDataLocalTemppip-install-60u406ebmousecontroller_e9ecf1693b5a49f6aa898bb92d39281am is not found.

Fix by using squared brackets:

scripts=['mousecontroller.py']

Side Note

mousecontroller.py

is not in the .tar.gz that is available on PyPi. Might be due to the same reason.

Answered By: FlyingTeller
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.