adafruit / Adafruit_Python_PlatformDetect

MIT License
59 stars 238 forks source link

SyntaxError: future feature annotations is not defined #225

Closed H-Y-H-Y-H closed 2 years ago

H-Y-H-Y-H commented 2 years ago

I was using this package and it worked perfectly. Now I have some trouble because I re-install the latest version which has "from future import annotations" in both board.py and chip.py files.

Below shows the error I got:

Traceback (most recent call last):
  File "servo_motor.py", line 1, in <module>
    from adafruit_servokit import ServoKit
  File "/home/nvidia/Desktop/face_env/lib/python3.6/site-packages/adafruit_servokit.py", line 35, in <module>
    import board
  File "/home/nvidia/Desktop/face_env/lib/python3.6/site-packages/board.py", line 39, in <module>
    import adafruit_platformdetect.constants.boards as ap_board
  File "/home/nvidia/Desktop/face_env/lib/python3.6/site-packages/adafruit_platformdetect/__init__.py", line 11, in <module>
    from .chip import Chip
  File "/home/nvidia/Desktop/face_env/lib/python3.6/site-packages/adafruit_platformdetect/chip.py", line 23
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined

I solved this by copying the previous version code.

dhalbert commented 2 years ago

adafruit-blinka is now requiring Python 3.7. This library should also be requiring 3.7.

Which board and OS are you using that only has Python 3.6? Are you able to upgrade?

makermelissa commented 2 years ago

It says nvidia, so maybe it's a Jetson Nano or something. I think the crux of this is that PlatformDetect is currently set to 3.6 as the required version, but actually requires a feature from 3.7.

yulu54 commented 2 years ago

I had similar problem. How about installing old version compatible with python 3.6.9? or will installing python 3.7 affect working with opencv negatively, is it necessary to update old opencv files?

dolikemedo commented 1 year ago

@yulu54 Hi, How did you solve this? I'm trying to install older versions of adafruit-circuitpython-ads1x15 and it has the same error. I don't understand how older version has the same error. I tried installing even the oldest versions with pip3 and still the same errors. I have python3.6.9 in a container and It caused other issues upgrading python. Thanks for your answer!

zyth0x-1 commented 1 year ago

I got past some of these issues with adafruit-io by forcing a lower version of setuptools-scm with pip install setuptools-scm==6.0.1 hope this helps someone