ModuleNotFoundError: No module named 'mockidp.saml
I have proceeded in installing mock-idp in Ubuntu 20.4, following the instructions in the README. When I run it, I get the error No module named 'mockidp.saml . I haven't touched any configuration files. Are there any steps I am missing?
I also encountered this. To fix it, I moved the file in bin-folder (a python file with missing extension) one level up, so the import-statement is finding the mockidp folder.
What I did:
- clone the repo
- create a virtual environment:
python -m venv venv- note that python must have been installed
- activate virtual environment:
venv/Scripts/activate.bat(.bat because I am on Windows) - run
pip install -r requirements
This is for basic setup. Now it should be possible to run the code.
The module mockidp refers to the folder with the same name. It can be imported from a python file, but not from bin-folder.
Thus, I moved the file in bin folder to the project root (and renamed it to "run-mock-idp.py")
So you have: ~/mockidp (folder) ~/run-mock-idp.py
Content of run-mock-idp.py is this: https://github.com/bjorns/mock-idp/blob/master/bin/mock-idp It just calls the main function from mockidp/main.py
This way, I am able to run it via python run-mock-idp.py
You may want to try my fork of this repo: link.
There, the run-mock-idp.py file is already in the correct place. I also added a vscode launch configuration there.
Hi @Adsidera
What version of python are you running? And can you also list the specific commands you are running?
I was not able to reproduce your problem but I'll admit the README could use some work.