0

Im trying to build an NSIS distributable, and this contains several packages. One of them is pyVISA-1.8 which needs the package enum34 to work.

Now, I usually bundle all the wheels I need for the packages in the nsis script, but when I do this for pyVISA , (i.e tell pip to pip install enum34-1.X.X.whl then pip install pyVisa-1.8.tar.gz I cant import visa without failures (pointing to enum34). (This might actually be a bug)

I found out that if i let let pip find the package on its own, the install works. This is not an option, however, because this distro should be able to be run on offline systems, so I need to have all the source code in the nsis installer.

How do I tell pip where the locally cached enum34.whl is located?

Regards

EDIT: Here is the error:

C:\Users\Administrator>pip list
ecdsa (0.13)
enum (0.4.6)
matplotlib (1.4.3)
numpy (1.9.2)
paramiko (1.15.2)
Pillow (3.1.0)
pip (7.1.2)
pycrypto (2.6.1)
pyparsing (2.0.7)
python-dateutil (2.4.2)
python-nmap (0.6.0)
pytz (2015.4)
requests (2.7.0)
setuptools (18.2)
six (1.10.0)

C:\Users\Administrator>pip install C:\python27\Dependencies\enum34-1.1.6-py2-non
e-any.whl
Processing c:\python27\dependencies\enum34-1.1.6-py2-none-any.whl
Installing collected packages: enum34
Successfully installed enum34-1.1.6

C:\Users\Administrator>pip install C:\python27\Dependencies\PyVISA-1.8.tar.gz
Processing c:\python27\dependencies\pyvisa-1.8.tar.gz
Requirement already satisfied (use --upgrade to upgrade): enum34 in c:\python27\
lib\site-packages (from PyVISA==1.8)
Installing collected packages: PyVISA
  Running setup.py install for PyVISA
Successfully installed PyVISA-1.8

C:\Users\Administrator>python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:32:19) [MSC v.1500 32 bit (
Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import visa
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\Python27\lib\site-packages\visa.py", line 16, in <module>
    from pyvisa import logger, __version__, log_to_screen, constants
  File "c:\Python27\lib\site-packages\pyvisa\__init__.py", line 45, in <module>
    from .highlevel import ResourceManager
  File "c:\Python27\lib\site-packages\pyvisa\highlevel.py", line 22, in <module>

    from . import constants
  File "c:\Python27\lib\site-packages\pyvisa\constants.py", line 599, in <module
>
    class AccessModes(enum.IntEnum):
AttributeError: 'module' object has no attribute 'IntEnum'
>>>
enrm
  • 645
  • 1
  • 8
  • 22
  • I cannot reproduce the issue you're describing... downloading enum34 wheel from pypi, installing it and THEN installing pypi works for me. `import visa` raised no errors. Can you add the specifics of your environment? – tutuDajuju Jul 08 '16 at 12:03
  • @tutuDajuju I'm trying on a virtualbox windows 7, currently trying to reproduce on my real machine in a `virtualenv` .. It's very weird that I get these errors.Consistently as well, I can clone my machine and try the installer and it fails every time. Until I let it download the requirements from PyPI, where it works perfectly – enrm Jul 08 '16 at 12:11
  • @tutuDajuju I know this sounds like I have the wrong enum whl locally but It's taken from the PyPI. Do you know how to only search locally for dependencies? – enrm Jul 08 '16 at 12:12
  • Using a virtualenv, I can install `enum34` and then `pyVISA` and it'll work. Perhaps something with the virtualbox VM is different from `virtualenv` ? – enrm Jul 08 '16 at 12:20
  • Try reproducing with verbose (`pip install -vv`). If you don't immediately see the problem, pastebin the log details as well as the `sys.path` and we can have a closer look – tutuDajuju Jul 08 '16 at 12:46
  • I just tried on another computer and it didnt work either. It gave the above error, even though both packages wrere installed according to `pip list` – enrm Jul 08 '16 at 13:33
  • here is the http://pastebin.com/EhYbRmqj here is my path (on Vbox) `>>> sys.path ['', 'c:\\Python27\\python27.zip', 'c:\\Python27\\DLLs', 'c:\\Python27\\lib', 'c:\\Python27\\lib\\plat-win', 'c:\\Python27\\lib\\lib-tk', 'c:\\Python27', 'c:\\Python27\\lib\\site-packages', 'c:\\Python27\\lib\\site-packages\wx-3.0-msw'] >>>` – enrm Jul 08 '16 at 13:43
  • It still gives the above error. .:( – enrm Jul 08 '16 at 13:54
  • Lets use chat: https://chat.stackoverflow.com/rooms/116810/discussion-of-question-38265820 – tutuDajuju Jul 08 '16 at 14:09

1 Answers1

1

The problem was that enum-0.4.6 was also installed and preceded enum34 in the path : (omn a brand new install with both packages installed:)

C:\Users\Administrator>python -c "import enum; print enum.__path__"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute '__path__' 

As we can see from the following statement:

C:\Users\Administrator>python -c "import sys; print sys.path"
['', 'c:\\Python27\\lib\\site-packages\\enum-0.4.6-py2.7.egg', ..... ] 

enum0.4.6 is the first path to be checked, which causes us problems, since we wanted enum34. I did not know their functionalities were not mutually exclusive. Anyway; uninstalling the enum 0.4.6 module solves all my problems, because enum34 is backported to python2.7 and has all the functionality of enum 0.4.6, apparently:

C:\Users\Administrator>pip uninstall enum
Uninstalling enum-0.4.6:
c:\python27\lib\site-packages\enum-0.4.6-py2.7.egg

Now we can check the path of the module:

C:\Users\Administrator>python -c "import enum; print enum.__path__"
['c:\\Python27\\lib\\site-packages\\enum']
enrm
  • 645
  • 1
  • 8
  • 22