Issue
I was working with my project and virtualenv together and read someplace that this isn't the best practice along with it mucked up my git repo.
Now I have cleaned my project folder (pyHoliday) and updated the gitignore file. Purged the system and started fresh doing:
- create a folder to hold the env and project files (pyHoliday/):
mkdir Documents/dev/pyHoliday
- cd to pyHoliday/:
cd pyholiday
- clone the pyHoliday python files into pyHoliday/:
git clone https://github.com/LanceGundersen/pyHoliday.git
- create python3 vituralenv:
virtualenv -p python3 env
- enable env virtualenv:
source env/bin/activate
- cd to python project:
cd pyHoliday
- install requirements:
pip install -r requirements.txt
- install project:
python setup.py install
-> Get a warningrunning install_lib warning: install_lib: 'build/lib' does not exist -- no Python modules to install
- Try to run the project:
holiday
Traceback (most recent call last): File "/home/lance/Documents/dev/pyHoliday/env/bin/holiday", line 6, in <module> from pyHoliday.pyHoliday import run ImportError: No module named 'pyHoliday'
Any clue what is going wrong here?
Thanks in advance!
Solution
In you repository pyHoliday
is not a package but a pyHoliday.py
module, so you shouldn't declare it as a package but as an item in py_modules
(in setup.cfg
):
py_modules =
pyHoliday
On the other hand you need to declare programs
as a package.
List site-packages/
in your virtual environment to see what is and what isn't installed.
Answered By - phd Answer Checked By - Candace Johnson (WPSolving Volunteer)