0

I created my first package with the following setup.py:

from setuptools import setup, find_packages
setup(
    name='mygn',
    version='0.1',
    packages=find_packages(exclude=['test', 'test.*']),
    include_package_data=True,
    platforms='any',
    install_requires=[
        'lxml==3.3.5',
        'Pillow==3.0.0',
        'requests==2.2.1',
        'xmltodict==0.10.1',
        'pdfrw==0.2',
        'python-dotenv==0.4.0',
        'boto==2.39.0',
        'click==6.4'
    ]
)

I installed it in a virtualenv using pip install . after which I view the installed packages with

$ pip freeze
boto==2.39.0
click==6.4
mygn==0.1      # <== here it is
lxml==3.3.5
ordereddict==1.1
pdfrw==0.2
Pillow==3.0.0
python-dotenv==0.4.0
requests==2.2.1
xmltodict==0.10.1

I then tried importing it, but that fails:

(venv) $ python
Python 2.7.10 (default, Oct 23 2015, 18:05:06)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mygn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named mygn
>>> import xmltodict  # no problem importing other modules from the pip freeze
>>> 

Any ideas what I could be doing wrong here?

kramer65
  • 50,427
  • 120
  • 308
  • 488

1 Answers1

1

Another person trying to import with a similar issue

This was their solution:

chmod -R 775 /usr/local/lib/python2.6/dist-packages/

It seems like this person resolved their issue by making sure that their access rights allowed them to use files from the distribution package folder. I would probably troubleshoot by doing the same thing by making sure your file and it's directory are open to you. Not too sure what might be causing it outside of that.

Community
  • 1
  • 1
Dresden
  • 549
  • 2
  • 13
  • I `chmod -R 777`-ed the whole virtualenv `venv` directory, but unfortunately that didn't help. Any other ideas? – kramer65 Mar 29 '16 at 18:56
  • I'm wondering if using single quotes for your find_packages exclusion will work with wild cards like you're using. I've only seen people use double quotes. Even for most examples like: **packages=find_packages(exclude=["*.tests", "*.tests.*"])**. One of the things I've been seeing as well is that even if you specify the information in **package_data** or your **MANIFEST.in** file some of the times **include_data_packages=True** will not actually use all of the files you have tried to include. You might want to try **distutils** instead of setuptools as well. – Dresden Mar 29 '16 at 22:37