1

I just refactored my Python project to be a single top-level module rather than a package.

However, pip install does not work anymore: I get an error which says:

(forcelib_test) C:\code>pip install git+https://github.com/blokeley/forcelib
Collecting git+https://github.com/blokeley/forcelib
  Cloning https://github.com/blokeley/forcelib to c:\users\tomoak~1\appdata\local\temp\pip-t10zegic-build
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info\forcelib.egg-info
    writing pip-egg-info\forcelib.egg-info\PKG-INFO
    writing dependency_links to pip-egg-info\forcelib.egg-info\dependency_links.txt
    writing requirements to pip-egg-info\forcelib.egg-info\requires.txt
    writing top-level names to pip-egg-info\forcelib.egg-info\top_level.txt
    writing manifest file 'pip-egg-info\forcelib.egg-info\SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    error: package directory 'forcelib' does not exist

I'm not trying to install a package called forcelib, only a module. The setup.py script correctly uses the py_modules argument rather than packages.

Is it possible to install a single module or do I have to revert to using a package?

Note: this question is about a different problem. They want to install an additional text file. I just want to install the single Python module. In fact, that question implies that what I'm trying to do should work without the error I got

blokeley
  • 6,726
  • 9
  • 53
  • 75
  • Possible duplicate of [Setting up setup.py for packaging of a single .py file and a single data file without needing to create any folders](https://stackoverflow.com/questions/12461603/setting-up-setup-py-for-packaging-of-a-single-py-file-and-a-single-data-file-wi) – Sraw Sep 12 '17 at 07:22
  • I don't think it's a duplicate. The referenced question is about how to install _additional supporting_ files. Indeed, that question implies that installing a single Python module should work. Is it possible to install just a Python module, not a package? I updated my question to address the potential duplicate. – blokeley Sep 12 '17 at 09:34
  • 1
    Possible duplicate of [PIP install "error: package directory 'X' does not exist"](https://stackoverflow.com/questions/25336150/pip-install-error-package-directory-x-does-not-exist) – phd Sep 12 '17 at 13:00
  • 1
    On reading the docs again, I think I need to say `py_modules=['forcelib']` not forcelib.py. I'll test later – blokeley Sep 12 '17 at 13:08

1 Answers1

1

I needed to use

 py_modules=['forcelib']

Rather than what I had which was

py_modules=['forcelib.py']
blokeley
  • 6,726
  • 9
  • 53
  • 75