Search code examples
pythonpipvirtualenv

Why my python package doesn't install in my virtualenv?


I made my own package, I succesfully installed it in my global pip with the command python setup.py install (from the directory where the code is) but when I tried the same command in a virtualenv everything seems to work but when I look at my pip list package of this virtualenv I can't see my package and I can't import it in my interpreter. The same result happen when I use pip install .

Output of the python setup.py install

(fig_local_analysis_virginia) ➜  parser_cvat git:(main) python setup.py install  
running install
/home/r2p2/Documents/virginia_project/fig_local_analysis/fig_local_analysis_virginia/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/home/r2p2/Documents/virginia_project/fig_local_analysis/fig_local_analysis_virginia/lib/python3.8/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running bdist_egg
running egg_info
writing cvat_parser.egg-info/PKG-INFO
writing dependency_links to cvat_parser.egg-info/dependency_links.txt
writing top-level names to cvat_parser.egg-info/top_level.txt
reading manifest file 'cvat_parser.egg-info/SOURCES.txt'
adding license file 'LICENSE.md'
writing manifest file 'cvat_parser.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/cvat_parser
copying build/lib/cvat_parser/parsing_cvat_file.py -> build/bdist.linux-x86_64/egg/cvat_parser
copying build/lib/cvat_parser/cvat_annotation_on_image.py -> build/bdist.linux-x86_64/egg/cvat_parser
copying build/lib/cvat_parser/type_cvat_parser.py -> build/bdist.linux-x86_64/egg/cvat_parser
copying build/lib/cvat_parser/__init__.py -> build/bdist.linux-x86_64/egg/cvat_parser
byte-compiling build/bdist.linux-x86_64/egg/cvat_parser/parsing_cvat_file.py to parsing_cvat_file.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/cvat_parser/cvat_annotation_on_image.py to cvat_annotation_on_image.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/cvat_parser/type_cvat_parser.py to type_cvat_parser.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/cvat_parser/__init__.py to __init__.cpython-38.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying cvat_parser.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying cvat_parser.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying cvat_parser.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying cvat_parser.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/cvat_parser-0.0.1-py3.8.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing cvat_parser-0.0.1-py3.8.egg
Removing /home/r2p2/Documents/virginia_project/fig_local_analysis/fig_local_analysis_virginia/lib/python3.8/site-packages/cvat_parser-0.0.1-py3.8.egg
Copying cvat_parser-0.0.1-py3.8.egg to /home/r2p2/Documents/virginia_project/fig_local_analysis/fig_local_analysis_virginia/lib/python3.8/site-packages
cvat-parser 0.0.1 is already the active version in easy-install.pth

Installed /home/r2p2/Documents/virginia_project/fig_local_analysis/fig_local_analysis_virginia/lib/python3.8/site-packages/cvat_parser-0.0.1-py3.8.egg
Processing dependencies for cvat-parser==0.0.1
Finished processing dependencies for cvat-parser==0.0.1
(fig_local_analysis_virginia) ➜  parser_cvat git:(main) 

Output of the pip install .

(fig_local_analysis_virginia) ➜  parser_cvat git:(main) pip install .                   
Processing /home/r2p2/Documents/virginia_project/parser_cvat
Building wheels for collected packages: cvat-parser
  Building wheel for cvat-parser (setup.py) ... done
  Created wheel for cvat-parser: filename=cvat_parser-0.0.1-py3-none-any.whl size=4347 sha256=fa0071a7de37749cb311cf366e265d602a6b790e9a95a26f9ece7b949d34b626
  Stored in directory: /tmp/pip-ephem-wheel-cache-zod4lic_/wheels/8a/db/73/568b5ff251d9fbb587cce00359c1099410982cce7baca6b78e
Successfully built cvat-parser
Installing collected packages: cvat-parser
  Attempting uninstall: cvat-parser
    Found existing installation: cvat-parser 0.0.1
    Uninstalling cvat-parser-0.0.1:
      Successfully uninstalled cvat-parser-0.0.1
Successfully installed cvat-parser-0.0.1
(fig_local_analysis_virginia) ➜  parser_cvat git:(main) 

I use the which python command to be sure to use the good version of python

fig_local_analysis_virginia) ➜  parser_cvat git:(main) which python
/home/r2p2/Documents/virginia_project/fig_local_analysis/fig_local_analysis_virginia/bin/python
(fig_local_analysis_virginia) ➜  parser_cvat git:(main) 

my version of pip is 22.2.2
my version of python is 3.8.10


Solution

  • There was 2 problems the first one was that my pip in virtualenv was not updated (I always have to update it manually) and the second problem was a typo in the name of the package.