robotpy / robotpy-wpilib

Moved to https://github.com/robotpy/mostrobotpy
https://robotpy.github.io
Other
169 stars 59 forks source link

Library installation via pip fails #27

Closed computer-whisperer closed 9 years ago

computer-whisperer commented 9 years ago

When I tried to install wpilib into a virtualenv with pip, I received a lovely error:

Unpacking /home/christian/PycharmProjects/robotpy-2015/wpilib
  Running setup.py egg_info for package from file:///home/christian/PycharmProjects/robotpy-2015/wpilib
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/tmp/pip-s6fqxp45-build/setup.py", line 25, in <module>
        with open(join(setup_dir, base_package, 'version.py'), 'r') as fp:
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-s6fqxp45-build/wpilib/version.py'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/tmp/pip-s6fqxp45-build/setup.py", line 25, in <module>

    with open(join(setup_dir, base_package, 'version.py'), 'r') as fp:

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-s6fqxp45-build/wpilib/version.py'

From what I can tell, it was due to setup not finding the version.py file, which wasn't created due to there being no .git in that directory.

I was able to bypass the error by commenting out that code, and replacing "__version__" with a random version number.

This issue seems to be present on the following files: wpilib/setup.py networktables/setup.py hal-sim/setup.py hal-base/setup.py

virtuald commented 9 years ago

I'll fix this later tonight.

virtuald commented 9 years ago

The reason I didn't run into this originally, is because I've been installing with 'pip install -e .' which installs the package in such a way that I can edit the source code, and the package pretends to be installed (it's super useful for development).

I have projects setup with Python 2, and they don't have this problem. In python 3, pip decides to put the files in a temporary directory, and does the install from there -- which of course, causes the failure.

I just set the version string to 'master' if the version file couldn't be found. I'm not 100% sure this solution won't cause problems in the future, but we'll see.