Cdhippen
Cdhippen

Reputation: 665

"Package directory does not exist" when running setup.py with sdist

I've got a game.py in ex48\ex48\game.py and my setup.py in ex48\docs\setup.py, I have init.py in both ex48\ex48__init.py and ex48\tests__init__.py . Game.py contains the following code:

class lexicon(object):

def __init__(self):
    pass

def lexicon(self):
    pass

setup.py contains the following code:

try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

config = {
    'description': 'ex48',
    'author': 'My Name',
    'url': 'URL to get it at.',
    'download_url': 'Where to download it.',
    'author_email': 'My email',
    'version': '0.1',
    'install_requires': ['nose'],
    'packages': ['ex48'],
    'scripts': [],
    'name': 'ex48'
}

setup(**config)

When I run python -m setup.py sdist I get the following message:

PS C:\python\projects\ex48\docs> python -m setup.py sdist
running sdist
running egg_info
writing requirements to ex48.egg-info\requires.txt
writing ex48.egg-info\PKG-INFO
writing top-level names to ex48.egg-info\top_level.txt
writing dependency_links to ex48.egg-info\dependency_links.txt
warning: manifest_maker: standard file '-c' not found

error: package directory 'ex48' does not exist

Here's a picture of my file structure: File Structure

Why am I getting this error?

===========================EDIT=============================== I put the setup file in the root folder instead of docs as suggested below. I then tried to install again, and got this:

PS C:\python\projects\ex48> python -m setup.py sdist
running sdist
running egg_info
writing requirements to ex48.egg-info\requires.txt
writing ex48.egg-info\PKG-INFO
writing top-level names to ex48.egg-info\top_level.txt
writing dependency_links to ex48.egg-info\dependency_links.txt
warning: manifest_maker: standard file '-c' not found

reading manifest file 'ex48.egg-info\SOURCES.txt'
writing manifest file 'ex48.egg-info\SOURCES.txt'
warning: sdist: standard file not found: should have one of README, README.rst, README.txt

running check
creating ex48-0.1
creating ex48-0.1\ex48
creating ex48-0.1\ex48.egg-info
copying files to ex48-0.1...
copying ex48\__init__.py -> ex48-0.1\ex48
copying ex48\game.py -> ex48-0.1\ex48
copying ex48.egg-info\PKG-INFO -> ex48-0.1\ex48.egg-info
copying ex48.egg-info\SOURCES.txt -> ex48-0.1\ex48.egg-info
copying ex48.egg-info\dependency_links.txt -> ex48-0.1\ex48.egg-info
copying ex48.egg-info\requires.txt -> ex48-0.1\ex48.egg-info
copying ex48.egg-info\top_level.txt -> ex48-0.1\ex48.egg-info
Writing ex48-0.1\setup.cfg
Creating tar archive
removing 'ex48-0.1' (and everything under it)
C:\Python27\python.exe: No module named setup.py

So I got two warnings about files not found, and when I try to import modules from my game file in another script, I get:

PS C:\python\projects\ex48> python tests\ex48_tests.py
Traceback (most recent call last):
    File "tests\ex48_tests.py", line 1, in <module>
        from ex48.game import lexicon
ImportError: No module named game

So something's not working, but I'm not sure what.

Upvotes: 4

Views: 2485

Answers (0)

Related Questions