ramachandran-lab / pong

Fast analysis and visualization of latent clusters in population genetic data
66 stars 11 forks source link

Pb with python3? #17

Closed jydu closed 4 years ago

jydu commented 4 years ago

Hi,

Since python2 is now deprecated, homebrew only provides python3. Trying to install pong leads to the following error:

pip3 install pong

Collecting pong
  Using cached pong-1.4.9.tar.gz (1.1 MB)
    ERROR: Command errored out with exit status 1:
     command: /usr/local/opt/python/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/b5/9p4ygkkj18lctw5fww_t0qz00000gq/T/pip-install-h5fu5kvg/pong/setup.py'"'"'; __file__='"'"'/private/var/folders/b5/9p4ygkkj18lctw5fww_t0qz00000gq/T/pip-install-h5fu5kvg/pong/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/b5/9p4ygkkj18lctw5fww_t0qz00000gq/T/pip-install-h5fu5kvg/pong/pip-egg-info
         cwd: /private/var/folders/b5/9p4ygkkj18lctw5fww_t0qz00000gq/T/pip-install-h5fu5kvg/pong/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/b5/9p4ygkkj18lctw5fww_t0qz00000gq/T/pip-install-h5fu5kvg/pong/setup.py", line 5, in <module>
        execfile("pong/__init__.py")
    NameError: name 'execfile' is not defined
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Am I doing something wrong?

Best regards,

Julien.

PS: I am running the latest Macos System.

jydu commented 4 years ago

I think I got it... I'm not python expert but a bit of googling told me that "execfile" is deprecated in python3. Replacing line 5 in the setup.py file by the following worked for me:

# get __version__
filename = "pong/__init__.py"
with open(filename, "rb") as source_file:
    code = compile(source_file.read(), filename, "exec")
exec(code)

maybe it might prove useful to others...?

All the best,

Julien.

shahamat commented 4 years ago

Thanks Julien, we are working on a python3 pong version and will release it soon.

jydu commented 4 years ago

Great! I tried to upgrade the code on the fly but got some JSON error in the end which I could not solve :s looking forward to having this great software running again :)

abehr commented 4 years ago

Hi Julien - here is a candidate release for python3 pong. We'll publish it soon but are still doing some more testing. Meanwhile, feel free to check it out - would love to hear if you're able to run it or encounter any issues!