3

My package is not installing completely with pip. Importing the module does not work and there is only the dist-info directory in site-packages. I haven't been able to solve the issue with other posts. I have the following package structure.

idbd_utils
+-- ncbi_taxonomy_utils
|   +-- __init__.py
|   +-- ncbi_taxonomy_utils.py 
|   +-- ncbi_taxonomy_all_names.dat
|   +-- ncbi_taxonomy_canonical_taxa.dat
|   +-- ncbi_taxonomy_children_nodes.dat
|   +-- ncbi_taxonomy_max_taxid.dat
|   +-- ncbi_taxonomy_merged.dat
|   +-- ncbi_taxonomy_names.dat
|   +-- ncbi_taxonomy_nodes_rank.dat
|   +-- ncbi_taxonomy_nodes_rel.dat
+-- LICENSE
+-- README.md
+-- MANIFEST.in
+-- setup.py

This is my setup.py

import setuptools

with open("README.md", "r") as fh:
    long_description = fh.read()

setuptools.setup(
    name="idbd_utils",
    version="0.0.1",
    author="Me",
    author_email="none@nomail.com",
    description="My packages",
    long_description=long_description,
    long_description_content_type="text/markdown",
    packages=setuptools.find_packages(),
    include_package_data=True,
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: None",
        "Operating System :: OS Independent",
    ],
)

To build, I use this command in the my_pckgs directory python3 setup.py sdist bdist_wheel

I then install with pip install .

When all is done, only my-pckgs-0.0.1.dist-info is in site packages, but no functional package. This is especially frustrating because it worked just fine before I changed the name of the parent directory (i.e. my_pckgs, which is just a pseudonym here, along with all other file names). I tried starting from scratch in a new directory but still have the same issue.

Output from pip install . -vvv

Created temporary directory: /private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-ephem-wheel-cache-6l8zh6wh
Created temporary directory: /private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-req-tracker-witkmyvg
Created requirements tracker '/private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-req-tracker-witkmyvg'
Created temporary directory: /private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-install-wldtr1vp
Processing /Users/jmontgomery/Desktop/idbd_utils
  Created temporary directory: /private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-req-build-ckfi4xc3
  Added file:///Users/jmontgomery/Desktop/idbd_utils to build tracker '/private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-req-tracker-witkmyvg'
    Running setup.py (path:/private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-req-build-ckfi4xc3/setup.py) egg_info for package from file:///Users/jmontgomery/Desktop/idbd_utils
    Running command python setup.py egg_info
    running egg_info
    creating pip-egg-info/idbd_utils.egg-info
    writing pip-egg-info/idbd_utils.egg-info/PKG-INFO
    writing dependency_links to pip-egg-info/idbd_utils.egg-info/dependency_links.txt
    writing top-level names to pip-egg-info/idbd_utils.egg-info/top_level.txt
    writing manifest file 'pip-egg-info/idbd_utils.egg-info/SOURCES.txt'
    reading manifest file 'pip-egg-info/idbd_utils.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'pip-egg-info/idbd_utils.egg-info/SOURCES.txt'
  Source in /private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-req-build-ckfi4xc3 has version 0.0.1, which satisfies requirement idbd-utils==0.0.1 from file:///Users/jmontgomery/Desktop/idbd_utils
  Removed idbd-utils==0.0.1 from file:///Users/jmontgomery/Desktop/idbd_utils from build tracker '/private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-req-tracker-witkmyvg'
Building wheels for collected packages: idbd-utils
  Created temporary directory: /private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-wheel-q47gqxjx
  Building wheel for idbd-utils (setup.py) ...   Destination directory: /private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-wheel-q47gqxjx
  Running command /Users/jmontgomery/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-req-build-ckfi4xc3/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-wheel-q47gqxjx --python-tag cp37
  running bdist_wheel
  running build
  running build_py
  running egg_info
  writing idbd_utils.egg-info/PKG-INFO
  writing dependency_links to idbd_utils.egg-info/dependency_links.txt
  writing top-level names to idbd_utils.egg-info/top_level.txt
  reading manifest file 'idbd_utils.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  writing manifest file 'idbd_utils.egg-info/SOURCES.txt'
  installing to build/bdist.macosx-10.7-x86_64/wheel
  running install
  running install_lib
  creating build/bdist.macosx-10.7-x86_64/wheel
  creating build/bdist.macosx-10.7-x86_64/wheel/ncbi_taxonomy_utils
  copying build/lib/ncbi_taxonomy_utils/ncbi_taxonomy_canonical_taxa.dat -> build/bdist.macosx-10.7-x86_64/wheel/ncbi_taxonomy_utils
  copying build/lib/ncbi_taxonomy_utils/ncbi_taxonomy_names.dat -> build/bdist.macosx-10.7-x86_64/wheel/ncbi_taxonomy_utils
  copying build/lib/ncbi_taxonomy_utils/ncbi_taxonomy_nodes_rank.dat -> build/bdist.macosx-10.7-x86_64/wheel/ncbi_taxonomy_utils
  copying build/lib/ncbi_taxonomy_utils/ncbi_taxonomy_utils.py -> build/bdist.macosx-10.7-x86_64/wheel/ncbi_taxonomy_utils
  copying build/lib/ncbi_taxonomy_utils/__init__.py -> build/bdist.macosx-10.7-x86_64/wheel/ncbi_taxonomy_utils
  copying build/lib/ncbi_taxonomy_utils/ncbi_taxonomy_nodes_rel.dat -> build/bdist.macosx-10.7-x86_64/wheel/ncbi_taxonomy_utils
  copying build/lib/ncbi_taxonomy_utils/ncbi_taxonomy_all_names.dat -> build/bdist.macosx-10.7-x86_64/wheel/ncbi_taxonomy_utils
  copying build/lib/ncbi_taxonomy_utils/ncbi_taxonomy_children_nodes.dat -> build/bdist.macosx-10.7-x86_64/wheel/ncbi_taxonomy_utils
  copying build/lib/ncbi_taxonomy_utils/ncbi_taxonomy_max_taxid.dat -> build/bdist.macosx-10.7-x86_64/wheel/ncbi_taxonomy_utils
  copying build/lib/ncbi_taxonomy_utils/ncbi_taxonomy_merged.dat -> build/bdist.macosx-10.7-x86_64/wheel/ncbi_taxonomy_utils
  running install_egg_info
  Copying idbd_utils.egg-info to build/bdist.macosx-10.7-x86_64/wheel/idbd_utils-0.0.1-py3.7.egg-info
  running install_scripts
  adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
  creating build/bdist.macosx-10.7-x86_64/wheel/idbd_utils-0.0.1.dist-info/WHEEL
  creating '/private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-wheel-q47gqxjx/idbd_utils-0.0.1-cp37-none-any.whl' and adding 'build/bdist.macosx-10.7-x86_64/wheel' to it
  adding 'ncbi_taxonomy_utils/__init__.py'
  adding 'ncbi_taxonomy_utils/ncbi_taxonomy_all_names.dat'
  adding 'ncbi_taxonomy_utils/ncbi_taxonomy_canonical_taxa.dat'
  adding 'ncbi_taxonomy_utils/ncbi_taxonomy_children_nodes.dat'
  adding 'ncbi_taxonomy_utils/ncbi_taxonomy_max_taxid.dat'
  adding 'ncbi_taxonomy_utils/ncbi_taxonomy_merged.dat'
  adding 'ncbi_taxonomy_utils/ncbi_taxonomy_names.dat'
  adding 'ncbi_taxonomy_utils/ncbi_taxonomy_nodes_rank.dat'
  adding 'ncbi_taxonomy_utils/ncbi_taxonomy_nodes_rel.dat'
  adding 'ncbi_taxonomy_utils/ncbi_taxonomy_utils.py'
  adding 'idbd_utils-0.0.1.dist-info/LICENSE'
  adding 'idbd_utils-0.0.1.dist-info/METADATA'
  adding 'idbd_utils-0.0.1.dist-info/WHEEL'
  adding 'idbd_utils-0.0.1.dist-info/top_level.txt'
  adding 'idbd_utils-0.0.1.dist-info/RECORD'
  removing build/bdist.macosx-10.7-x86_64/wheel
done
  Stored in directory: /private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-ephem-wheel-cache-6l8zh6wh/wheels/4b/52/74/ad0979a3cf5ca994d3db19b67a30f9f89fcd4bf541f2f6c64c
  Removing source in /private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-req-build-ckfi4xc3
Successfully built idbd-utils
Installing collected packages: idbd-utils

Successfully installed idbd-utils-0.0.1
Cleaning up...
Removed build tracker '/private/var/folders/6z/rh94tt3x73sbzgdnk29bxjnh0000gn/T/pip-req-tracker-witkmyvg'
J. Montgomery
  • 53
  • 1
  • 5
  • 2
    Are all packages listed when you run `python -c "from setuptools import find_packages; print(find_packages())"` from `my_pckgs`. If yes, run `pip install . -vvv` and add the full install log. Other than that, check the hints in [this answer of mine](https://stackoverflow.com/questions/50585246/pip-install-creates-only-the-dist-info-not-the-package/54357929#54357929), might be of help. – hoefling Aug 15 '19 at 07:37
  • Thanks @hoefling. I spent a good amount of time going through your previous answer, but didn't come up with a solution. I made my question more explicit so the output below makes sense. All packages are listed when I run the first command. Output: ['ncbi_taxonomy_utils']. Output from second command included in question above. Nothing looks off from what little knowledge I have. – J. Montgomery Aug 15 '19 at 14:46
  • I'm seeing I probably didn't understand how this works. I noticed that a folder named `ncbi_taxonomy_utils` is installed in site_packages as well. I thought I had to import from the package, i.e. `from ibdb_tools.ncbi_taxonomy_utils` .... But instead I skip the top level and import with `from ncbi_taxonomy_utils.ncbi_taxonomy_utils import` .... This should have been obvious. If I want to import from the parent package directory, would I include another `__init__.py` under the `idbd_utils` directory? – J. Montgomery Aug 15 '19 at 15:05
  • 2
    Yes, in your current setup, `idbd_utils` is the project root (directory that contains your project) and `ncbi_taxonomy_utils` is the only python package (containing the code). You can of course create another directory `idbd_utils`, create an empty `idbd_utils/__init__.py` and put `ncbi_taxonomy_utils` inside `idbd_utils`, there's nothing wrong with that. Just keep in mind that the project root dir (the one that contains `setup.py`, packages with code, the readme etc. is not a package itself. – hoefling Aug 15 '19 at 15:39

0 Answers0