churchmanlab / genewalk

GeneWalk identifies relevant gene functions for a biological context using network representation learning
https://churchman.med.harvard.edu/genewalk
BSD 2-Clause "Simplified" License
127 stars 14 forks source link

compiling the resource folder - error #15

Closed jrconner16 closed 4 years ago

jrconner16 commented 4 years ago

Hi,

Thanks again for making this and making it available.

I'm new to python- I apologize if my error is something basic but I'd appreciate anyone taking a look:

I installed the genewalk using pip install genewalk

got one error: indra 1.15.1 has requirement networkx<=2.3,>=2, but you'll have networkx 2.4 which is incompatible.

but then indra (1.15.1 ) installs anyway and appears in the list when I run
conda list

I've attempted to run the following command with the same error. I ran it in a python 3.7 env and 3.5 and got basically the same error. Any ideas?

(py35) osx2560:~ James$ genewalk --project QKI --genes ~/Downloads/QKI_forGW.csv --id_type mgi_id
INFO: [2019-10-30 08:50:15] genewalk.cli - Creating project folder at /Users/James/genewalk/QKI
INFO: [2019-10-30 08:50:15] genewalk.resources - Using /Users/James/genewalk/resources as resource folder.
INFO: [2019-10-30 08:50:15] genewalk.resources - Downloading http://snapshot.geneontology.org/ontology/go.obo into /Users/James/genewalk/resources/go.obo
Traceback (most recent call last):
  File "/Users/James/miniconda3/envs/py35/bin/genewalk", line 11, in <module>
    sys.exit(main())
  File "/Users/James/miniconda3/envs/py35/lib/python3.5/site-packages/genewalk/cli.py", line 145, in main
    rm.download_all()
  File "/Users/James/miniconda3/envs/py35/lib/python3.5/site-packages/genewalk/resources.py", line 51, in download_all
    self.get_go_obo()
  File "/Users/James/miniconda3/envs/py35/lib/python3.5/site-packages/genewalk/resources.py", line 20, in get_go_obo
    download_go(fname)
  File "/Users/James/miniconda3/envs/py35/lib/python3.5/site-packages/genewalk/resources.py", line 59, in download_go
    urllib.request.urlretrieve(url, fname)
  File "/Users/James/miniconda3/envs/py35/lib/python3.5/urllib/request.py", line 188, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "/Users/James/miniconda3/envs/py35/lib/python3.5/urllib/request.py", line 163, in urlopen
    return opener.open(url, data, timeout)
  File "/Users/James/miniconda3/envs/py35/lib/python3.5/urllib/request.py", line 472, in open
    response = meth(req, response)
  File "/Users/James/miniconda3/envs/py35/lib/python3.5/urllib/request.py", line 582, in http_response
    'http', request, response, code, msg, hdrs)
  File "/Users/James/miniconda3/envs/py35/lib/python3.5/urllib/request.py", line 510, in error
    return self._call_chain(*args)
  File "/Users/James/miniconda3/envs/py35/lib/python3.5/urllib/request.py", line 444, in _call_chain
    result = func(*args)
  File "/Users/James/miniconda3/envs/py35/lib/python3.5/urllib/request.py", line 590, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
ri23 commented 4 years ago

Hi, This looks like a bug regarding conflicting networkx versions on our end. We'll look into this. Thanks for bringing this up.

bgyori commented 4 years ago

Hi @jrconner16, pip typically allows you to install packages with incompatible version requirements, but emits a warning to tell you about it. The current PyPI release of INDRA indeed has a <=2.3 version requirement. This limitation will be removed very soon. In any case, it shouldn't cause any problems in practice when you use GeneWalk.

In terms of the HTTP error, that seems to me like a temporary network issue with accessing http://snapshot.geneontology.org/ontology/go.obo. Does the problem still persist on your end?

jrconner16 commented 4 years ago

Hi @bgyori,

Thanks for the version info about pip / INDRA.

Yes, I am still getting that HTTP error when I run: genewalk --project QKI --genes ~/Downloads/QKI_forGW.csv --id_type mgi_id

I have internet and I can go to that URL and download the file, then view it with a browser.

ri23 commented 4 years ago

Hi @jrconner16, I've just tested a new installation with a python 3.7 virtual environment and it gave no error: the go.obo downloaded alright and program started running so I suspect something has happened with your installation. What were the commands you used to create / activate your virtual environment? Was it using conda? Just to make sure, have you run pip install genewalk inside the virtual environment? If not sure, could you activate the py37 virtual env and run pip install --upgrade genewalk and list any errors you might encounter. Also after the upgrade try running again from within py37 env to see if the error persists?

jrconner16 commented 4 years ago

Activating p37, upgrading genewalk, and running it still produces that error. I installed genewalk in the base environment as well as in a py35 and py37 conda env. I can activate each environment and run the command to produce the same error.

I do think I did something wrong in my install (or just user error) but I'm not entirely sure what. I'm not that confident in my ability to uninstall conda/pip/python/genewalk and reinstall without messing up other envs I use--So I was going to try this from scratch on another computer or in a virtual environment to see if I can get it to work.

Thanks again for all your time/help

bgyori commented 4 years ago

I am not able to reproduce this issue and I doubt it's directly caused by GeneWalk. My best guess is that it has to do with your local network settings. For instance, it's possible that your browser has custom proxy settings that lets you access the file manually in your browser, but the same settings aren't available for Python. Try doing the following: Launch a simple python interpreter in the Terminal and then run:

import requests
requests.get('http://snapshot.geneontology.org/ontology/go.obo')

If you get the same 404 error then it is a general issue with network settings unrelated to GeneWalk.

ri23 commented 4 years ago

Hi @jrconner16 , I agree with Ben's comments above. If you are going down the route of trying on another computer, then I would recommend to avoid using conda if you can and instead just do a clean download / install of python 3.7.5 from the python.org website. Then run in terminal: pip3 install virtualenv virtualenv -p /usr/local/bin/python3 gwenv source gwenv/bin/activate pip install genewalk genewalk --project QKI --genes ~/Downloads/QKI_forGW.csv --id_type mgi_id

jrconner16 commented 4 years ago

@bgyori I launched a python interpreter and the request.get() had a 404. Thanks for helping me figure that out.

@ri23 Agreed that installing independent of conda is probably a good bet. Thank you for code to quickly test it, I will try the that on my laptop or home PC as soon as I get the chance.

update: got the demo running on my original computer by connecting to a different (public) network

Thanks for all the help!