1

I have created this minimal setup.py using https://github.com/pypa/sampleproject 's sample setup.py. This is my first encounter with setup.py system. The end result is:

with open(path.join(here, 'README'), encoding='utf-8') as f:
    long_description = f.read()

setup(
    name='mkbib',
    version='0.1',
    description='BibTeX Creator',
    author='Rudra Banerjee',
    author_email='bnrj.rudra@gmail.com',
    license='GPLv3',
    keywords='BibTeX',
    packages=find_packages(exclude=['contrib', 'docs', 'tests']),
    install_requires=['bibtexparser'],
    entry_points={
        'gui_scripts': [
            'mkbib=src:main',
        ],
    },
)

My directory structure is:

tree setup.py src/
setup.py [error opening dir]
src/
├── main.py
├── menubar.ui
├── menu.py
├── pybib.py
└── view.py

I run (if I don't build it) the code as:

python3 main.py

Now, if I am running setup.py --install --prefix=/var/tmp (I have added required PYTHONPATH etc to install it in /var/tmp), its coming out without any error:

Installing mkbib script to /var/tmp/bin

Installed /var/tmp/lib/python3.4/site-packages/mkbib-0.1-py3.4.egg
Processing dependencies for mkbib==0.1
Searching for bibtexparser==0.6.2
Best match: bibtexparser 0.6.2
Adding bibtexparser 0.6.2 to easy-install.pth file

Using /usr/lib/python3.4/site-packages

But, running the /var/tmp/bin/mkbib is giving error:

Traceback (most recent call last):
  File "./mkbib", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 3084, in <module>
    @_call_aside
  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 3070, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 3097, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 651, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 952, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 839, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'mkbib==0.1' distribution was not found and is required by the application

This is, as I previously said, my first setup.py, so, dont understand what's going wrong here.

BaRud
  • 3,055
  • 7
  • 41
  • 89
  • What *exactly* is your `PYTHONPATH` set to? –  Feb 25 '16 at 22:19
  • /var/tmp, as suggested by setup.py – BaRud Feb 25 '16 at 22:24
  • you have a `src` folder with a buch of scripts, that's not a python package. To match your setup.py, it shouldn't be named `src` but `mkbib`, have an `__init__.py` and that should have a `main()` as entry point for your console script. You're not supposed to execute a pthon module withing a package using `pyton3 main.py`, but by running `python3 -m mkbib.main` from the parent folder. – mata Feb 25 '16 at 22:39
  • Set your `PYTHONPATH` to `/var/tmp/lib/python3.4/site-packages/`. –  Feb 25 '16 at 23:59
  • "I have added required PYTHONPATH etc to install it in /var/tmp". That doesn't make sense: `PYTHONPATH` does *not* determine where things are installed. `PYTHONPATH` tells Python where you *have* installed modules & packages. –  Feb 26 '16 at 00:00

0 Answers0