panisson / pymobility

python implementation of mobility models
85 stars 35 forks source link

No module found error, Improper installation? #4

Open PranavMahajan25 opened 5 years ago

PranavMahajan25 commented 5 years ago

File "/home/pranav/anaconda3/envs/my_lab/lib/python3.6/site-packages/pymobility-0.1.0-py3.6.egg/pymobility/models/__init__.py", line 1, in <module> ModuleNotFoundError: No module named 'mobility' This is the error I get whenever I try to import any mobility model, say running the command: from pymobility.models.mobility import random_waypoint But import pymobility doesn't give any errors. I've followed the installation steps exactly as in readme file. Is it due to python setup.py install ? I've used this repo before and it worked fine.

ersabine commented 5 years ago

Have you solved this issue?

ardimasp commented 4 years ago

Add this into the root init file. from pymobility import models

And, modify the child init file as: from pymobility.models.mobility import *

Sidharth3301 commented 3 years ago

Could you specify what you meant by child init file?

hzang001 commented 3 years ago

File "/home/pranav/anaconda3/envs/my_lab/lib/python3.6/site-packages/pymobility-0.1.0-py3.6.egg/pymobility/models/__init__.py", line 1, in <module> ModuleNotFoundError: No module named 'mobility' This is the error I get whenever I try to import any mobility model, say running the command: from pymobility.models.mobility import random_waypoint But import pymobility doesn't give any errors. I've followed the installation steps exactly as in readme file. Is it due to python setup.py install ? I've used this repo before and it worked fine.

I got the same issue, did u find the reason.

GeneLYJ commented 3 years ago

Well, what I did is that I move mobility.py from the pymobility/src/pymobility/models directory to pymobility/src/pymobility. Then I change in simulation.py code from pymobility.models.mobility import gauss_markov, reference_point_group, \ tvc, truncated_levy_walk, random_direction, random_waypoint, random_walk

to from mobility import gauss_markov, reference_point_group, \ tvc, truncated_levy_walk, random_direction, random_waypoint, random_walk

So it doesn't need to directly import from lib library instead directly from same directory as the simulation.py directory. Hope this helps.

Sidharth3301 commented 3 years ago

I think the main issue was that there are two python binaries in your laptop and python setup.py installonly installs the python2 egg the author has set up. python3 setup.py install should work fine to install the python3 egg to run your python3 code