lukasschwab / arxiv.py

Python wrapper for the arXiv API
MIT License
1.11k stars 123 forks source link

Package not updated in pip? #17

Closed awade closed 5 years ago

awade commented 6 years ago

I just ran > pip install arxiv

as per instructions in readme and had issues with the sort_by argument in the query method.

Looking back through the closed issues it looks like this is because this is an old version of the query function. The pip hasn't been updated and the pip method of install is still working off a rather old version.

Looks like the issue was closed after master was released as 0.2.3 (see issue #16 ). Not sure what is supposed to happen with the pip when a new tag is added. The default version installed by pip method is still old and doesn't seem to updated.

Thought I'd open a new issue to flag that original sort_by arg issue isn't actually fixed.

Thanks, Andrew

lukasschwab commented 6 years ago

Thanks for opening an issue!

Here's my understanding:

  1. You installed the package with pip install arxiv
  2. The installed version is 0.2.3
  3. There is some bug with the sort_by functionality.

A couple points of clarification:

I freshly installed arxiv from pip:

$ pip install arxiv
$ pip show arxiv
Name: arxiv
Version: 0.2.3
[...]

Ran some cursory tests in python 2.7.15, which worked as expected:

import arxiv

outRelevance = arxiv.query(search_query="test", sort_by="relevance")
outDate = arxiv.query(search_query="test", sort_by="submittedDate")

outRelevance[0]['links'] # Different first entries.
outDate[0]['links'] # Different first entries.

Happy to get this fixed as soon as I can replicate your error!

Cheers

awade commented 6 years ago

Ok, so I think the issue is that my python3 environment is actually running previous 0.2.2. When I uninstall and install using the --no-cache-dir flag I still get 0.2.2 for python3

I am able to get the correct 0.2.3 when installing in a python2 virtual environment. Here are the steps for python2 that worked for me:

$ virtualenv pyenv2
$ source pyenv2/bin/activate
$ python --version 
Returns: 
Python 2.7.14
$ pip install --no-cache-dir arxiv
$ pip show arxiv
Returns: 
Name: arxiv
Version: 0.2.3
Summary: Python wrapper for the arXiv....

Your test code sample works fine.

Now repeat with python3

$ virtualenv -p python3 pyenv3
$ source pyenv3/bin/activate
$ python --version
Returns: Python 3.6.5 :: Anaconda, Inc.
$ pip install --no-cache-dir arxiv
Returns:
Collecting arxiv
  Downloading https://files.pythonhosted.org/packages/6f/56/356a49116d109a852527f8ac2415fd2687973d36e404194b2fafb0444b7e/arxiv-0.2.2.tar.gz
Collecting feedparser (from arxiv)
  Downloading https://files.pythonhosted.org/packages/91/d8/7d37fec71ff7c9dbcdd80d2b48bcdd86d6af502156fc93846fb0102cb2c4/feedparser-5.2.1.tar.bz2 (192kB)
    100% |████████████████████████████████| 194kB 10.6MB/s 
Requirement already satisfied: requests in /usr/local/anaconda3/lib/python3.6/site-packages (from arxiv) (2.18.4)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/anaconda3/lib/python3.6/site-packages (from requests->arxiv) (3.0.4)
Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/anaconda3/lib/python3.6/site-packages (from requests->arxiv) (2.6)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/anaconda3/lib/python3.6/site-packages (from requests->arxiv) (1.22)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/anaconda3/lib/python3.6/site-packages (from requests->arxiv) (2018.4.16)
distributed 1.21.8 requires msgpack, which is not installed.
Installing collected packages: feedparser, arxiv
  Running setup.py install for feedparser ... done
  Running setup.py install for arxiv ... done
Successfully installed arxiv-0.2.2 feedparser-5.2.1
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

> pip show arxiv
Returns:
Name: arxiv
Version: 0.2.2
Summary: Python wrapper for....

The test code fails for this python3 environment

Looking in the environment /lib/python3.6/site-packages it is clear that the python3 version is just using the 0.2.2 tag.

I've attached a Dockerfile that exactly reproduces the environment that causes the issue: Dockerfile.zip

lukasschwab commented 6 years ago

Is there reason to believe this is an issue with the release to PyPI rather than with that version of pip?

awade commented 6 years ago

I upgrade pip and re-ran. Same issue.

On a clean python (3.6.5) I get

pip list
Package    Version   
---------- ----------
arxiv      0.2.2     
certifi    2018.10.15
chardet    3.0.4     
feedparser 5.2.1     
idna       2.7       
pip        18.1      
requests   2.20.0    
setuptools 40.4.3    
urllib3    1.24      
wheel      0.32.2    

Seems to still be a version back.

taneta commented 5 years ago

The issue can be solved by installing directly from git repo: pip install git+git://github.com/lukasschwab/arxiv.py

lukasschwab commented 5 years ago

@taneta did you encounter the same issue?

taneta commented 5 years ago

Yes, Python 3 downloaded 0.2.2 version from pip

lukasschwab commented 5 years ago

This issue is pretty odd––I haven't been able to dedicate a great deal of time to debugging it (incl. spinning up the Docker environment @fincle shared) and I haven't found lots of documentation of similar issues.

My hunch is that this has to do with the new Warehouse implementation of PyPI, but the arxiv 0.2.3 was released after that new version was rolled out.

I'm glad there's a holdover solution by installing directly from the git repo. It is probably preferable to specify the version: pip install "arxiv==0.2.3"––assuming that pip can resolve the version.