After setup.py install cannot import new module

python 3.6.4

I was able to run python setup.py install in my environment and then i was able to run my test.py which simply imports my new module.

In circleci, it seems that it is unable to find my module even though the install seems to have worked without any errors.

Here is my output:
my commands in config.yml

. venv/bin/activate
cd alm
pwd
echo start installing
python setup.py install
cd …
echo pip freeze
pip freeze
python --version
pip --version
echo ‘start testing’
python test2.py

output from the commands above

running bdist_egg
running egg_info
creating ALM.egg-info
writing ALM.egg-info/PKG-INFO
writing dependency_links to ALM.egg-info/dependency_links.txt
writing top-level names to ALM.egg-info/top_level.txt
writing manifest file ‘ALM.egg-info/SOURCES.txt’
reading manifest file ‘ALM.egg-info/SOURCES.txt’
reading manifest template ‘MANIFEST.in’
warning: no files found matching ‘servers_template.py’
writing manifest file ‘ALM.egg-info/SOURCES.txt’
installing library code to build/bdist.linux-x86_64/egg
running install_lib
warning: install_lib: ‘build/lib’ does not exist – no Python modules to install

creating build
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying ALM.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying ALM.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying ALM.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying ALM.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents…
creating dist
creating ‘dist/ALM-0.0.1-py3.6.egg’ and adding ‘build/bdist.linux-x86_64/egg’ to it
removing ‘build/bdist.linux-x86_64/egg’ (and everything under it)
Processing ALM-0.0.1-py3.6.egg
Copying ALM-0.0.1-py3.6.egg to /home/circleci/alm/venv/lib/python3.6/site-packages
Adding ALM 0.0.1 to easy-install.pth file

Installed /home/circleci/alm/venv/lib/python3.6/site-packages/ALM-0.0.1-py3.6.egg
Processing dependencies for ALM==0.0.1
Finished processing dependencies for ALM==0.0.1
pip freeze
ALM==0.0.1
certifi==2019.3.9
chardet==3.0.4
idna==2.8
requests==2.21.0
urllib3==1.24.1
You are using pip version 9.0.1, however version 19.0.3 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
Python 3.6.1
pip 9.0.1 from /home/circleci/alm/venv/lib/python3.6/site-packages (python 3.6)
start testing
Traceback (most recent call last):
File “test2.py”, line 2, in
import ALM
ModuleNotFoundError: No module named ‘ALM’
Exited with code 1

Please help.
thanks. :slight_smile:

hi guys,
I just realized that the error above is the culprit. After the error, it does not continue the installation.

Anyone know how i why build/lib doesn’t exist in virtualenv in circleci?

I saw something related the other day. Do you happen to have a build directory in your repo? If so, can you try renaming it? Python imports are weird.

Thanks for your reply, drazisil.
I found the problem. It was my dumb mistake. I forgot to
git add __init __.py file. :blush:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.