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

SyntaxError: future feature annotations is not defined #14

Closed
Ciao-Z opened this issue Apr 7, 2021 · 16 comments
Closed

SyntaxError: future feature annotations is not defined #14

Ciao-Z opened this issue Apr 7, 2021 · 16 comments

Comments

@Ciao-Z
Copy link

Ciao-Z commented Apr 7, 2021

Hi, csuhan.
when I tested the code, an error occurred.
Traceback (most recent call last):
File "tools/test.py", line 12, in
from mmdet.apis import init_dist
File "/root/code/remote-sensing-detection/ReDet-master/mmdet/apis/init.py", line 2, in
from .train import train_detector
File "/root/code/remote-sensing-detection/ReDet-master/mmdet/apis/train.py", line 14, in
from mmdet.models import RPN
File "/root/code/remote-sensing-detection/ReDet-master/mmdet/models/init.py", line 1, in
from .backbones import * # noqa: F401,F403
File "/root/code/remote-sensing-detection/ReDet-master/mmdet/models/backbones/init.py", line 2, in
from .re_resnet import ReResNet
File "/root/code/remote-sensing-detection/ReDet-master/mmdet/models/backbones/re_resnet.py", line 5, in
import e2cnn.nn as enn
File "/usr/local/anaconda3/envs/pytorch1.4+10.1/lib/python3.6/site-packages/e2cnn-0.1.7-py3.6.egg/e2cnn/init.py", line 17, in
from e2cnn import group
File "/usr/local/anaconda3/envs/pytorch1.4+10.1/lib/python3.6/site-packages/e2cnn-0.1.7-py3.6.egg/e2cnn/group/init.py", line 4, in
from .group import Group
File "/usr/local/anaconda3/envs/pytorch1.4+10.1/lib/python3.6/site-packages/e2cnn-0.1.7-py3.6.egg/e2cnn/group/group.py", line 2
from future import annotations
^
SyntaxError: future feature annotations is not defined
how can I solve this error?

@csuhan
Copy link
Owner

csuhan commented Apr 7, 2021

Two solutions:

  1. Try Python>=3.7
  2. For Python<=3.6, you need:
git clone -b legacy_py3.6 https://github.com/QUVA-Lab/e2cnn.git
cd e2cnn
python setup.py install

@Ciao-Z
Copy link
Author

Ciao-Z commented Apr 8, 2021

Two solutions:

1. Try Python>=3.7

2. For Python<=3.6, you need:
git clone -b legacy_py3.6 https://github.com/QUVA-Lab/e2cnn.git
cd e2cnn
python setup.py install

Thx for your reply. it works!

@Ciao-Z Ciao-Z closed this as completed Apr 8, 2021
@SamMohel
Copy link

excuse me i was countered this error and tried the solution but error exists . but i have this

File "/usr/local/lib/python3.6/dist-packages/e2cnn-0.1.7-py3.6.egg/e2cnn/group/group.py", line 2 from __future__ import annotations ^ SyntaxError: future feature annotations is not defined

instead of site-packages

Appreciate your help

@imvickykumar999
Copy link

imvickykumar999 commented Sep 7, 2021

Two solutions:

  1. Try Python>=3.7
  2. For Python<=3.6, you need:
git clone -b legacy_py3.6 https://github.com/QUVA-Lab/e2cnn.git
cd e2cnn
python setup.py install

I am using reels downloader with flask framework
from instascrape import Reel

and works well on localhost but not on deployed site,

https://github.com/imvickykumar999/imvickykumar999/blob/a7fa7fbb9eb76ef2d77be15998f62d12ef695f77/vicks/reels.py#L16

and getting error as

future feature annotations is not defined (profile.py, line 1)

imvickykumar999 added a commit to imvickykumar999/imvickykumar999 that referenced this issue Sep 7, 2021
csuhan/ReDet#14 (comment)

future feature annotations is not defined (profile.py, line 1)
@imvickykumar999
Copy link

Two solutions:

  1. Try Python>=3.7
  2. For Python<=3.6, you need:
git clone -b legacy_py3.6 https://github.com/QUVA-Lab/e2cnn.git
cd e2cnn
python setup.py install

I am using reels downloader with flask framework
from instascrape import Reel

and works well on localhost but not on deployed site,

https://github.com/imvickykumar999/imvickykumar999/blob/a7fa7fbb9eb76ef2d77be15998f62d12ef695f77/vicks/reels.py#L16

and getting error as

future feature annotations is not defined (profile.py, line 1)


Finally I found solution,
It require python>=3.7 version, so runtime.txt added to my repo to change default python version used by heroku.
https://github.com/imvickykumar999/imvickykumar999/blob/master/runtime.txt

@nkadel
Copy link

nkadel commented Nov 22, 2021

Minimal RHEL and CentOS 7 images have fallen out of date quite quickly and have many dependencies which may be updated with installed ansible related packages. Do a "yum update" first with clean new golden images, to avoid the bulky accumulation of such updates for breaking other installations.

Changing your default python 3 is not a step for the weak of heart. RHEL 8 and CentOS 8 have python3.8 available, but it's not published or not yet published for RHEL 7, which is its own problem. It is published as an SCL component, but those are notoriously pesky to work with and are not supported by EPEL unlike the way python3.6 was supported for a time. It's very frustrating that Red Hat elected to publish python36 packages as python3, it has seriously broken compatibility with various EPEL modules and with Amazon Linux 2, which followed Red Hat's ill-thought-out behaviour and published python3.7 packages as "python3", leading to thorough brokenness with EPEL, especially for current ansible-core releases.

@AlitaYang
Copy link

Two solutions:

  1. Try Python>=3.7
  2. For Python<=3.6, you need:
git clone -b legacy_py3.6 https://github.com/QUVA-Lab/e2cnn.git
cd e2cnn
python setup.py install

Doesn't work for me :(

1 similar comment
@AlitaYang
Copy link

Two solutions:

  1. Try Python>=3.7
  2. For Python<=3.6, you need:
git clone -b legacy_py3.6 https://github.com/QUVA-Lab/e2cnn.git
cd e2cnn
python setup.py install

Doesn't work for me :(

@JamesXNelson
Copy link

For my purposes, this is how I'm installing newer python versions on centos 7. Best to do in a base image of some kind, as it's very slow.

mkdir -p /tmp/pyInstall
cd /tmp/pyInstall
sudo yum -y groupinstall "Development Tools"
sudo yum -y install openssl-devel bzip2-devel libffi-devel wget
PY_VERSION=3.9.13
wget https://www.python.org/ftp/python/$PY_VERSION/Python-${PY_VERSION}.tgz
tar xvf Python-${PY_VERSION}.tgz
cd /tmp/pyInstall/Python-3.9*/
# It is _very_ important to have --enable-shared flag, as we require libpython for runtime dynamic linking
sudo ./configure --prefix=/usr --enable-shared LDFLAGS="-Wl,-rpath,/usr/lib64" --enable-optimizations
sudo make altinstall
sudo ldconfig

If you don't need libpython, you can simplify a little, but figured I'd leave some breadcrumbs for y'all

@sthakur84
Copy link

sthakur84 commented Nov 18, 2022

Doesn't work with airflow packages with option 2 (```
git clone -b legacy_py3.6 https://github.com/QUVA-Lab/e2cnn.git
cd e2cnn
python setup.py install

Searching for scipy
Reading https://pypi.org/simple/scipy/
Downloading https://files.pythonhosted.org/packages/0a/2e/44795c6398e24e45fa0bb61c3e98de1cfea567b1b51efd3751e2f7ff9720/scipy-1.9.3.tar.gz#sha256=fbc5c05c85c1a02be77b1ff591087c83bc44579c6d2bd9fb798bb64ea5e1a027
Best match: scipy 1.9.3
Processing scipy-1.9.3.tar.gz
Writing /var/folders/f_/7vstf97j517b5sb77v46rwq40000gq/T/easy_install-59kswnu6/scipy-1.9.3/setup.cfg
Running scipy-1.9.3/setup.py -q bdist_egg --dist-dir /var/folders/f_/7vstf97j517b5sb77v46rwq40000gq/T/easy_install-59kswnu6/scipy-1.9.3/egg-dist-tmp-jl9ck5kb
Traceback (most recent call last):
  File "/usr/local/anaconda3/envs/airflowenv/lib/python3.6/site-packages/setuptools/sandbox.py", line 156, in save_modules
    yield saved
  File "/usr/local/anaconda3/envs/airflowenv/lib/python3.6/site-packages/setuptools/sandbox.py", line 198, in setup_context
    yield
  File "/usr/local/anaconda3/envs/airflowenv/lib/python3.6/site-packages/setuptools/sandbox.py", line 259, in run_setup
    _execfile(setup_script, ns)
  File "/usr/local/anaconda3/envs/airflowenv/lib/python3.6/site-packages/setuptools/sandbox.py", line 46, in _execfile
    exec(code, globals, locals)
  File "/var/folders/f_/7vstf97j517b5sb77v46rwq40000gq/T/easy_install-59kswnu6/scipy-1.9.3/setup.py", line 33, in <module>
    keywords=[
RuntimeError: Python version >= 3.8 required.

@JackThird
Copy link

Doesn't work with airflow packages with option 2 (``` git clone -b legacy_py3.6 https://github.com/QUVA-Lab/e2cnn.git cd e2cnn python setup.py install

Searching for scipy
Reading https://pypi.org/simple/scipy/
Downloading https://files.pythonhosted.org/packages/0a/2e/44795c6398e24e45fa0bb61c3e98de1cfea567b1b51efd3751e2f7ff9720/scipy-1.9.3.tar.gz#sha256=fbc5c05c85c1a02be77b1ff591087c83bc44579c6d2bd9fb798bb64ea5e1a027
Best match: scipy 1.9.3
Processing scipy-1.9.3.tar.gz
Writing /var/folders/f_/7vstf97j517b5sb77v46rwq40000gq/T/easy_install-59kswnu6/scipy-1.9.3/setup.cfg
Running scipy-1.9.3/setup.py -q bdist_egg --dist-dir /var/folders/f_/7vstf97j517b5sb77v46rwq40000gq/T/easy_install-59kswnu6/scipy-1.9.3/egg-dist-tmp-jl9ck5kb
Traceback (most recent call last):
  File "/usr/local/anaconda3/envs/airflowenv/lib/python3.6/site-packages/setuptools/sandbox.py", line 156, in save_modules
    yield saved
  File "/usr/local/anaconda3/envs/airflowenv/lib/python3.6/site-packages/setuptools/sandbox.py", line 198, in setup_context
    yield
  File "/usr/local/anaconda3/envs/airflowenv/lib/python3.6/site-packages/setuptools/sandbox.py", line 259, in run_setup
    _execfile(setup_script, ns)
  File "/usr/local/anaconda3/envs/airflowenv/lib/python3.6/site-packages/setuptools/sandbox.py", line 46, in _execfile
    exec(code, globals, locals)
  File "/var/folders/f_/7vstf97j517b5sb77v46rwq40000gq/T/easy_install-59kswnu6/scipy-1.9.3/setup.py", line 33, in <module>
    keywords=[
RuntimeError: Python version >= 3.8 required.

try "pip3 install scipy"

@nkadel
Copy link

nkadel commented Nov 25, 2022 via email

@artempostnikov1
Copy link

installing previous version of telegram api helped me
pip install pyTelegramBotAPI==3.6.0

I had problem deploying telebot on server that have only Python 3.6.9 and all these methods didnt help me

@nkadel
Copy link

nkadel commented Mar 22, 2023

If you need a more recent python, use one. On RHEL 7, python311 and python311-pip are easily available via RPM and you can then use "pip3.11" if needed. They were added since I previoosly wrote about SCLO releases.

@hepcat72
Copy link

I cannot figure out how to get a working installation of the latest multiqc. I've tried installing it with multiple version of python >=3.7, but mambe keeps telling me:

$ mamba create --name multiqc multiqc python=3.7
Encountered problems while solving:
  - package multiqc-0.4-py27_0 requires python 2.7*, but none of the providers can be installed
$ mamba create --name multiqc multiqc=1.14 python=3.7
Encountered problems while solving:
  - package multiqc-1.14-pyhdfd78af_0 requires requests, but none of the providers can be installed
$ mamba create --name multiqc multiqc=1.13 python=3.7
Encountered problems while solving:
  - package multiqc-1.13a-pyhdfd78af_0 requires requests, but none of the providers can be installed
$ mamba create --name multiqc multiqc=1.13a python=3.7
Encountered problems while solving:
  - package multiqc-1.13a-pyhdfd78af_0 requires requests, but none of the providers can be installed
$ mamba create --name multiqc multiqc=1.12 python=3.7
Encountered problems while solving:
  - package multiqc-1.12-pyhdfd78af_0 requires requests, but none of the providers can be installed
$ mamba create --name multiqc multiqc=1.14 python=3.9
Encountered problems while solving:
  - package multiqc-1.14-pyhdfd78af_0 requires requests, but none of the providers can be installed
$ mamba create --name multiqc multiqc=1.14 python=3.11
Encountered problems while solving:
  - package python-3.11.0-h559f36b_0_cpython requires libffi >=3.4.2,<3.5.0a0, but none of the providers can be installed

Could someone provide the conda/mamba command that will create an environment with a versiuon that won't produce the error:

SyntaxError: future feature annotations is not defined

@Ashish-neo
Copy link

Two solutions:

  1. Try Python>=3.7
  2. For Python<=3.6, you need:
git clone -b legacy_py3.6 https://github.com/QUVA-Lab/e2cnn.git
cd e2cnn
python setup.py install

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