myint / yolk

Command-line tool for querying PyPI and Python packages installed on your system (with Python 3 support)
https://pypi.python.org/pypi/yolk3k
BSD 3-Clause "New" or "Revised" License
66 stars 12 forks source link

Something strange with yolk and import. #10

Closed vskubriev closed 7 years ago

vskubriev commented 7 years ago
In [1]: from yolk import yolklib

In [2]: list(yolklib.get_distributions('all', 'numpy'))
Out[2]: 
[(numpy 1.11.2 (/usr/local/lib/python2.7/dist-packages), False),
 (numpy 1.12.0 (/usr/local/lib/python2.7/dist-packages), True),
 (numpy 1.12.1 (/usr/local/lib/python2.7/dist-packages), False),
 (numpy 1.8.2 (/usr/lib/python2.7/dist-packages), False)]

In [3]: import numpy

In [4]: numpy.__version__
Out[4]: '1.12.1'

As you can see yolk gets 1.12.0 as active version instead of import, which is load 1.12.1

Why this happens ?

vskubriev commented 7 years ago

The same or similar problem with six:

In [1]: import six

In [2]: six.__version__
Out[2]: '1.10.0'

root@machine:/home/user# yolk -l six
six             - 1.10.0       - non-active development (/usr/local/lib/python2.7/dist-packages)
six             - 1.5.2        - non-active 
six             - 1.9.0        - active development (/usr/local/lib/python2.7/dist-packages)

yolk reports active version is 1.9.0, but actually active is 1.10.0

vskubriev commented 7 years ago

Is there a way to automatically remove packages like six 1.9.0 in my case ?

root@machine:/home/user# yolk -l six
six             - 1.10.0       - non-active development (/usr/local/lib/python2.7/dist-packages)
six             - 1.5.2        - non-active 
six             - 1.9.0        - active development (/usr/local/lib/python2.7/dist-packages)
root@machine:/home/user# python -c 'import six; print six.__version__'
1.10.0

The system has only its metadata:

root@machine:/home/use# ll /usr/local/lib/python2.7/dist-packages/six-1.9.0.dist-info/
total 32
drwxr-sr-x   2 root staff 4096 Apr 22  2015 ./
drwxrwsr-x 108 root staff 4096 May  4 17:27 ../
-rw-r--r--   1 root root   772 Apr 22  2015 DESCRIPTION.rst
-rw-r--r--   1 root root  1280 Apr 22  2015 METADATA
-rw-r--r--   1 root root   657 Apr 22  2015 metadata.json
-rw-r--r--   1 root staff  544 Apr 22  2015 RECORD
-rw-r--r--   1 root root     4 Apr 22  2015 top_level.txt
-rw-r--r--   1 root root   110 Apr 22  2015 WHEEL