Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doesn't work with python 2.7? #32

Closed
jaconstantine opened this issue Jul 10, 2018 · 4 comments
Closed

doesn't work with python 2.7? #32

jaconstantine opened this issue Jul 10, 2018 · 4 comments

Comments

@jaconstantine
Copy link

installation:

pi@62fib-raspberry:~/SenseMe/SenseMe $ python setup.py install
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
running install
running bdist_egg
running egg_info
creating SenseMe.egg-info
writing SenseMe.egg-info/PKG-INFO
writing top-level names to SenseMe.egg-info/top_level.txt
writing dependency_links to SenseMe.egg-info/dependency_links.txt
writing manifest file 'SenseMe.egg-info/SOURCES.txt'
reading manifest file 'SenseMe.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.txt' under directory 'docs'
writing manifest file 'SenseMe.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv7l/egg
running install_lib
running build_py
creating build
creating build/lib.linux-armv7l-2.7
creating build/lib.linux-armv7l-2.7/senseme
copying senseme/__init__.py -> build/lib.linux-armv7l-2.7/senseme
copying senseme/senseme.py -> build/lib.linux-armv7l-2.7/senseme
copying senseme/known_attribs.py -> build/lib.linux-armv7l-2.7/senseme
creating build/lib.linux-armv7l-2.7/senseme/lib
copying senseme/lib/__init__.py -> build/lib.linux-armv7l-2.7/senseme/lib
copying senseme/lib/mwt.py -> build/lib.linux-armv7l-2.7/senseme/lib
copying senseme/lib/perpetualtimer.py -> build/lib.linux-armv7l-2.7/senseme/lib
copying senseme/lib/background_monitor.py -> build/lib.linux-armv7l-2.7/senseme/lib
copying senseme/lib/xml.py -> build/lib.linux-armv7l-2.7/senseme/lib
creating build/lib.linux-armv7l-2.7/bin
copying bin/__init__.py -> build/lib.linux-armv7l-2.7/bin
creating build/bdist.linux-armv7l
creating build/bdist.linux-armv7l/egg
creating build/bdist.linux-armv7l/egg/bin
copying build/lib.linux-armv7l-2.7/bin/__init__.py -> build/bdist.linux-armv7l/egg/bin
creating build/bdist.linux-armv7l/egg/senseme
copying build/lib.linux-armv7l-2.7/senseme/__init__.py -> build/bdist.linux-armv7l/egg/senseme
creating build/bdist.linux-armv7l/egg/senseme/lib
copying build/lib.linux-armv7l-2.7/senseme/lib/__init__.py -> build/bdist.linux-armv7l/egg/senseme/lib
copying build/lib.linux-armv7l-2.7/senseme/lib/mwt.py -> build/bdist.linux-armv7l/egg/senseme/lib
copying build/lib.linux-armv7l-2.7/senseme/lib/perpetualtimer.py -> build/bdist.linux-armv7l/egg/senseme/lib
copying build/lib.linux-armv7l-2.7/senseme/lib/background_monitor.py -> build/bdist.linux-armv7l/egg/senseme/lib
copying build/lib.linux-armv7l-2.7/senseme/lib/xml.py -> build/bdist.linux-armv7l/egg/senseme/lib
copying build/lib.linux-armv7l-2.7/senseme/senseme.py -> build/bdist.linux-armv7l/egg/senseme
copying build/lib.linux-armv7l-2.7/senseme/known_attribs.py -> build/bdist.linux-armv7l/egg/senseme
byte-compiling build/bdist.linux-armv7l/egg/bin/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-armv7l/egg/senseme/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-armv7l/egg/senseme/lib/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-armv7l/egg/senseme/lib/mwt.py to mwt.pyc
byte-compiling build/bdist.linux-armv7l/egg/senseme/lib/perpetualtimer.py to perpetualtimer.pyc
byte-compiling build/bdist.linux-armv7l/egg/senseme/lib/background_monitor.py to background_monitor.pyc
byte-compiling build/bdist.linux-armv7l/egg/senseme/lib/xml.py to xml.pyc
byte-compiling build/bdist.linux-armv7l/egg/senseme/senseme.py to senseme.pyc
  File "build/bdist.linux-armv7l/egg/senseme/senseme.py", line 84
    f"SenseMe(name='{self.name}', ip='{self.ip}', "
                                                  ^
SyntaxError: invalid syntax

byte-compiling build/bdist.linux-armv7l/egg/senseme/known_attribs.py to known_attribs.pyc
creating build/bdist.linux-armv7l/egg/EGG-INFO
installing scripts to build/bdist.linux-armv7l/egg/EGG-INFO/scripts
running install_scripts
running build_scripts
creating build/scripts-2.7
copying and adjusting bin/senseme_cli -> build/scripts-2.7
changing mode of build/scripts-2.7/senseme_cli from 644 to 755
creating build/bdist.linux-armv7l/egg/EGG-INFO/scripts
copying build/scripts-2.7/senseme_cli -> build/bdist.linux-armv7l/egg/EGG-INFO/scripts
changing mode of build/bdist.linux-armv7l/egg/EGG-INFO/scripts/senseme_cli to 755
copying SenseMe.egg-info/PKG-INFO -> build/bdist.linux-armv7l/egg/EGG-INFO
copying SenseMe.egg-info/SOURCES.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying SenseMe.egg-info/dependency_links.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying SenseMe.egg-info/top_level.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/SenseMe-0.1.3-py2.7.egg' and adding 'build/bdist.linux-armv7l/egg' to it
removing 'build/bdist.linux-armv7l/egg' (and everything under it)
Processing SenseMe-0.1.3-py2.7.egg
Copying SenseMe-0.1.3-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Adding SenseMe 0.1.3 to easy-install.pth file
Installing senseme_cli script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/SenseMe-0.1.3-py2.7.egg
Processing dependencies for SenseMe==0.1.3
Finished processing dependencies for SenseMe==0.1.3

cli:

pi@62fib-raspberry:~/SenseMe $ senseme_cli
Traceback (most recent call last):
  File "/usr/local/bin/senseme_cli", line 4, in <module>
    __import__('pkg_resources').run_script('SenseMe==0.1.3', 'senseme_cli')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 534, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1444, in run_script
    script_code = compile(script_text, script_filename,'exec')
  File "/usr/local/lib/python2.7/dist-packages/SenseMe-0.1.3-py2.7.egg/EGG-INFO/scripts/senseme_cli", line 21
    VALID_PARAMS = f"on off {' '.join([str(x) for x in range(17)])}".split()
                                                                   ^
SyntaxError: invalid syntax

usage:

pi@62fib-raspberry:~/SenseMe $ python test.py
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    from senseme import discover
  File "build/bdist.linux-armv7l/egg/senseme/__init__.py", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/SenseMe-0.1.3-py2.7.egg/senseme/senseme.py", line 84
    f"SenseMe(name='{self.name}', ip='{self.ip}', "
                                                  ^
SyntaxError: invalid syntax
pi@62fib-raspberry:~/SenseMe $ python --version
Python 2.7.9

Is this an arm issue or a known issue with 2.7?

@TomFaulkner
Copy link
Owner

TomFaulkner commented Jul 11, 2018

ARM CPUs should be fine, but the code requires Python 3.6+. I haven't made any attempt to have backwards compatibility.

Python 2.7 will no longer be supported by the Python Software Foundation in 17 months. Unfortunately, setup.py doesn't automatically prevent installation of incompatible packages, I suppose I could put a version check in the setup.py. I put a version check in the setup.py to prevent installation, with a nice error message, on older versions of Python.

Have you tried running using the python3 binary? (Just swap in python3 for python in your commands.) Is installing 3.7, or 3.6, an option for you? (It isn't too difficult, but might take half an hour on a Pi if your distribution doesn't have a package for it.) If not, a docker image would work. (Docker is something I've been meaning to add to this library, but haven't done so yet.)

Also, it doesn't appear you are using a virtual environment. It's not advisable to install libraries into the system Python, as it can create conflicts with libraries and scripts the system depends on. For example, if this library used the requests library, but required a newer version that had a breaking change it could break your system.

This was referenced Jul 11, 2018
@TomFaulkner
Copy link
Owner

Release 0.1.4 prevents installation on 2.7.
https://github.com/TomFaulkner/SenseMe/releases/tag/v0.1.4
https://pypi.org/project/senseme/

@jaconstantine
Copy link
Author

Thanks for taking a look. Raspbian jessie doesn't have python3.6, the newest is python3.4. This is a remote embedded application so I won't be upgrading to stretch for a while.

@TomFaulkner
Copy link
Owner

I think it would be best to install 3.7 from source then. pyenv makes it convenient.

I make use of fstrings, which is a 3.6 feature. If those were replaced with the older format methods it would run on 3.5. I don't know if there is anything that wouldn't run on 3.4 other than that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants