kosarev / zx

ZX Spectrum emulator written in a mix of Python and C++
https://twitter.com/z80tools
MIT License
21 stars 1 forks source link

Fix installing the zx package #12

Closed kosarev closed 4 years ago

kosarev commented 4 years ago

Jose @boriel reports that pip3 install git+https://github.com/kosarev/zx does not work as expected.

It seems the emulator can't find the ROM file when installed this way. Will look into it. Thanks, Jose!

kosarev commented 4 years ago

@boriel Should be fixed as of 787f8321e10a7d78628655aba0bc58f08f221a05. Can you check it on your side, please?

boriel commented 4 years ago

Still, not using pip install -e but just pip install shows an error. This time it's this one:

  File "/home/boriel/.virtualenvs/zxbasic/bin/zx", line 11, in <module>
    load_entry_point('zx==0.7.0', 'console_scripts', 'zx')()
  File "/home/boriel/.virtualenvs/zxbasic/lib/python3.6/site-packages/pkg_resources/__init__.py", line 487, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/boriel/.virtualenvs/zxbasic/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2728, in load_entry_point
    return ep.load()
  File "/home/boriel/.virtualenvs/zxbasic/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2346, in load
    return self.resolve()
  File "/home/boriel/.virtualenvs/zxbasic/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2352, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/boriel/.virtualenvs/zxbasic/lib/python3.6/site-packages/zx/__init__.py", line 12, in <module>
    from ._emulator import Emulator
ImportError: cannot import name 'Emulator'
kosarev commented 4 years ago

Hmm. It works for me. Here's what I do on my Ubuntu 18.04:

$ virtualenv venv --system-site-packages
$ source venv/bin/activate
$ pip3 install zx
$ zx

What system are you on? Did you try it on a clean just-created venv?

The problem might be that you did pip install -e zx and then pip uninstall zx. The latter removes the package, but leaves the driver in bin/. So another thing that might be worth trying is:

  1. pip uninstall zx
  2. Removing that bin/zx script mentioned in your stacktrace above manually.
  3. It may also be a good idea to check it manually that there are no any lib/python3.*/site-packages/zx* directories already installed under your venv, ~/.local/ and /usr/local/.
  4. hash -r
  5. pip install zx
boriel commented 4 years ago

It works, thanks!! (seems my virtualenv was dirty)