lingthio / Flask-User

Customizable User Authorization & User Management: Register, Confirm, Login, Change username/password, Forgot password and more.
http://flask-user.readthedocs.io/
MIT License
1.06k stars 294 forks source link

pkg_resources.DistributionNotFound: The 'Flask' distribution was not found and is required by Flask-Login #254

Closed zacqed closed 2 years ago

zacqed commented 5 years ago

Flask_User is breaking the installation on AWS using ElasticBeanStalk. The specific portion of the error log is as follows:

Collecting Flask-User==1.0.1.3 (from -r /opt/python/ondeck/app/requirements.txt (line 16))
Using cached https://files.pythonhosted.org/packages/fd/e6/092c5c74251372568665f59e4df78d3450992289d5023e2abb77eee7b905/Flask-User-1.0.1.3.tar.gz
Complete output from command python setup.py egg_info:

Installed /tmp/pip-build-k2s8h7v3/Flask-User/.eggs/Flask_Login-0.4.1-py3.6.egg
Searching for Flask
Downloading https://files.pythonhosted.org/packages/c1/ff/bd9a4d2d81bf0c07d9e53e8cd3d675c56553719bbefd372df69bf1b3c1e4/Flask-Login-0.4.1.tar.gz#sha256=c815c1ac7b3e35e2081685e389a665f2c74d7e077cb93cecabaea352da4752ec
Best match: Flask Login-0.4.1
Processing Flask-Login-0.4.1.tar.gz
Writing /tmp/easy_install-wwxz50l_/Flask-Login-0.4.1/setup.cfg
Running Flask-Login-0.4.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-wwxz50l_/Flask-Login-0.4.1/egg-dist-tmp-qnbi69bv
removing '/tmp/pip-build-k2s8h7v3/Flask-User/.eggs/Flask_Login-0.4.1-py3.6.egg' (and everything under it)
creating /tmp/pip-build-k2s8h7v3/Flask-User/.eggs/Flask_Login-0.4.1-py3.6.egg
Extracting Flask_Login-0.4.1-py3.6.egg to /tmp/pip-build-k2s8h7v3/Flask-User/.eggs

Installed /tmp/pip-build-k2s8h7v3/Flask-User/.eggs/Flask_Login-0.4.1-py3.6.egg
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-k2s8h7v3/Flask-User/setup.py", line 87, in <module>
tests_require=['pytest'],
File "/usr/lib64/python3.6/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/dist.py", line 315, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/dist.py", line 361, in fetch_build_eggs
replace_conflicting=True,
File "/opt/python/run/venv/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 853, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'Flask' distribution was not found and is required by Flask-Login

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-k2s8h7v3/Flask-User/
You are using pip version 9.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
2019-01-09 07:00:25,743 ERROR Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1
Traceback (most recent call last):
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
install_dependencies()
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
File "/usr/lib64/python2.7/subprocess.py", line 190, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1.

Any help on the issue would be appreciated. It seems flask_user is unable to identify the existing installation of Flask library.

hardingmatt commented 5 years ago

I ran into this same problem. I was able to work around it by reverting to Flask-User==0.6. (Note that this will require changes to your code.)

I'm not 100% sure, but the root cause might be related to these issues within setuptools:

If that is the root cause, then it might help to move Flask to the end of install_requires in setup.py.

wayne-li2 commented 5 years ago

Not OP but I tried moving Flask to the end of install_requires on a custom package... didn't work :( Thanks for the suggestion though

Yeah this issue is blocking me too.

wayne-li2 commented 5 years ago

Update: I forked to here: https://github.com/wayne-li2/Flask-User And uploaded to PyPi under 'Flask-User-AWS==1.0.1.7' (pip install Flask-User-AWS) And the Elastic Beanstalk build passed. I tried moving Flask to the bottom of 'install_requires' but that didn't work. Then I tried that + remove 'Flask-Login' from setup_requires, and that seemed to work. However, I have no idea how breaking this will be for Flask-User itself. So use with caution.

rich-sykes commented 5 years ago

I have just deployed @wayne-li2 release on Heroku successfully.

sdpetrides commented 5 years ago

I had a similar issue with pip installation on CircleCI. I made the "remove 'Flask-Login' from setup_requires" change to @wayne-li2 in own fork here and the installation proceeded without an error.

See my fork here: https://github.com/sdpetrides/Flask-User/tree/circleci-pip-install

engineerakki commented 4 years ago

@wayne-li2 's release works on CircleCI as well.

avbentem commented 4 years ago

I was able to work around it by reverting to Flask-User==0.6.

A bit late, so merely for future readers: it seems that specifying any version may solve this, so: specifying the current version may be doing the trick as well.

https://github.com/pypa/setuptools/issues/498