vyapp / vy

A vim-like in python made from scratch.
MIT License
1.15k stars 54 forks source link

"No module named 'base'" error message while trying to run for the first time #24

Closed ghost closed 7 years ago

ghost commented 7 years ago

Greetings! This is the second time I issue an issue at Github, so I apologize in advance if I do something wrong.

I'm relatively new to Python, so I couldn't figure out if it is a missing library problem on my environment side.

My environment: Arch Linux with python3.6 and python2.7 with some modules, (among them jedi and pigments, all installed with pacman package manager)

I tried both with my global environment and with Python's virtualenv and both produced the same error message. To simplify things, I'll put virtualenv's terminal output below to avoid misunderstandings:

$ git clone https://github.com/iogf/vy
Cloning into 'vy'...
remote: Counting objects: 3499, done.
remote: Compressing objects: 100% (82/82), done.
remote: Total 3499 (delta 15), reused 0 (delta 0), pack-reused 3417
Receiving objects: 100% (3499/3499), 6.30 MiB | 2.66 MiB/s, done.
Resolving deltas: 100% (2476/2476), done.

$ mv vy vy-ee
$ python -m venv vy
$ mv vy-ee/* vy/
$ mv vy-ee/.git vy/
$ rm -r vy-ee
$ cd vy
$ source bin/activate
$ pip install -r requirements.txt
Collecting jedi (from -r requirements.txt (line 1))
  Downloading jedi-0.10.1-py2.py3-none-any.whl (179kB)
    100% |████████████████████████████████| 184kB 723kB/s 
Collecting pygments (from -r requirements.txt (line 2))
  Downloading Pygments-2.2.0-py2.py3-none-any.whl (841kB)
    100% |████████████████████████████████| 849kB 910kB/s 
Collecting untwisted (from -r requirements.txt (line 3))
  Using cached untwisted-1.0.1.tar.gz
Installing collected packages: jedi, pygments, untwisted
  Running setup.py install for untwisted ... done
Successfully installed jedi-0.10.1 pygments-2.2.0 untwisted-1.0.1

$ pip list --format=columns
Package    Version
---------- -------
jedi       0.10.1 
pip        9.0.1  
Pygments   2.2.0  
setuptools 28.8.0 
untwisted  1.0.1

$ ./vy          
Traceback (most recent call last):
  File "./vy", line 3, in <module>
    import vyapp.app
  File "/home/archie/github/vy/vyapp/app.py", line 6, in <module>
    from base import App, Debug
ModuleNotFoundError: No module named 'base'
$

Thanks since now.

iogf commented 7 years ago

The module exists. it is just that when you do ./vy python attempts to look for the module from your installed modules, it is not considering the project's path.

https://github.com/iogf/vy/blob/master/vyapp/base.py

Try installing vy from pip, pip2 install vy make sure you installed requirements with pip2 too.

in arch linux dists python3 is default, so you're trying to run vy in py3 not py3 because you didnt add a 2 in the pip install instruction.

iogf commented 7 years ago

setup virtualenv

cd ~/.virtualenvs/
ls -la
virtualenv vy -p /usr/bin/python2

activate virtualenv.

cd ~/.virtualenvs/
source vy/bin/activate
cd ~/projects/vy-code

install vy.

cd ~/projects/vy-code
pip2 install -r requirements.txt

python2 setup.py install

./vy

# or 

vy
ghost commented 7 years ago

Wow, thanks for the fast reply! You were definitely right, I was doing my setup with python3 instead of python2. Also I didn't realize I should run setup.py. I did follow and adapted your steps and the software did work.

Thank you very much and congrats, your software seems soft and clean.

iogf commented 7 years ago

Thank you. Feel free to contact me at any time. I hope you enjoy vy, the docs need a bit of clarification if you feel likely some stuff is not clear, please let me know. There are some features that arent yet documented too.