Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
884 views
in Technique[技术] by (71.8m points)

python - Getting an error : ModuleNotFoundError: No module named 'sklearn.linear_model._logistic' in Heroku

Getting an error: ModuleNotFoundError: No module named 'sklearn.linear_model._logistic'

Requirements.txt:

gunicorn==19.9.0
pandas==0.25.0
requests==2.22.0
scikit-learn==0.21.3
scipy==1.3.1
python-dateutil==2.8.1

Logs:

2020-06-02T07:59:31.971060+00:00 heroku[web.1]: Starting process with command `gunicorn app:app`
2020-06-02T07:59:34.365130+00:00 app[web.1]: [2020-06-02 07:59:34 +0000] [4] [INFO] Starting gunicorn 19.9.0
2020-06-02T07:59:34.365824+00:00 app[web.1]: [2020-06-02 07:59:34 +0000] [4] [INFO] Listening at: http://0.0.0.0:58585 (4)
2020-06-02T07:59:34.365932+00:00 app[web.1]: [2020-06-02 07:59:34 +0000] [4] [INFO] Using worker: sync
2020-06-02T07:59:34.370144+00:00 app[web.1]: [2020-06-02 07:59:34 +0000] [10] [INFO] Booting worker with pid: 10
2020-06-02T07:59:34.444717+00:00 app[web.1]: [2020-06-02 07:59:34 +0000] [18] [INFO] Booting worker with pid: 18
2020-06-02T07:59:36.981072+00:00 heroku[web.1]: Starting process with command `gunicorn app:app`
2020-06-02T07:59:38.011940+00:00 app[web.1]: [2020-06-02 07:59:38 +0000] [18] [ERROR] Exception in worker process
2020-06-02T07:59:38.011983+00:00 app[web.1]: Traceback (most recent call last):
2020-06-02T07:59:38.011984+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2020-06-02T07:59:38.011985+00:00 app[web.1]:     worker.init_process()
2020-06-02T07:59:38.011986+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process
2020-06-02T07:59:38.011986+00:00 app[web.1]:     self.load_wsgi()
2020-06-02T07:59:38.011987+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
2020-06-02T07:59:38.011987+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2020-06-02T07:59:38.011987+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-06-02T07:59:38.011988+00:00 app[web.1]:     self.callable = self.load()
2020-06-02T07:59:38.011988+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
2020-06-02T07:59:38.011989+00:00 app[web.1]:     return self.load_wsgiapp()
2020-06-02T07:59:38.011989+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
2020-06-02T07:59:38.011989+00:00 app[web.1]:     return util.import_app(self.app_uri)
2020-06-02T07:59:38.011990+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app
2020-06-02T07:59:38.011990+00:00 app[web.1]:     __import__(module)
2020-06-02T07:59:38.011990+00:00 app[web.1]:   File "/app/app.py", line 4, in <module>
2020-06-02T07:59:38.011991+00:00 app[web.1]:     import sklearn.linear_model._logistic
2020-06-02T07:59:38.012000+00:00 app[web.1]: ModuleNotFoundError: No module named 'sklearn.linear_model._logistic'
2020-06-02T07:59:38.012410+00:00 app[web.1]: [2020-06-02 07:59:38 +0000] [10] [ERROR] Exception in worker process
2020-06-02T07:59:38.012411+00:00 app[web.1]: Traceback (most recent call last):
2020-06-02T07:59:38.012412+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2020-06-02T07:59:38.012412+00:00 app[web.1]:     worker.init_process()
2020-06-02T07:59:38.012413+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process
2020-06-02T07:59:38.012413+00:00 app[web.1]:     self.load_wsgi()
2020-06-02T07:59:38.012414+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
2020-06-02T07:59:38.012414+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2020-06-02T07:59:38.012414+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-06-02T07:59:38.012415+00:00 app[web.1]:     self.callable = self.load()
2020-06-02T07:59:38.012415+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
2020-06-02T07:59:38.012415+00:00 app[web.1]:     return self.load_wsgiapp()
2020-06-02T07:59:38.012424+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
2020-06-02T07:59:38.012425+00:00 app[web.1]:     return util.import_app(self.app_uri)
2020-06-02T07:59:38.012425+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app
2020-06-02T07:59:38.012425+00:00 app[web.1]:     __import__(module)
2020-06-02T07:59:38.012426+00:00 app[web.1]:   File "/app/app.py", line 4, in <module>
2020-06-02T07:59:38.012426+00:00 app[web.1]:     import sklearn.linear_model._logistic
2020-06-02T07:59:38.012470+00:00 app[web.1]: ModuleNotFoundError: No module named 'sklearn.linear_model._logistic'
2020-06-02T07:59:38.013250+00:00 app[web.1]: [2020-06-02 07:59:38 +0000] [18] [INFO] Worker exiting (pid: 18)
2020-06-02T07:59:38.013864+00:00 app[web.1]: [2020-06-02 07:59:38 +0000] [10] [INFO] Worker exiting (pid: 10)
2020-06-02T07:59:38.241359+00:00 app[web.1]: Traceback (most recent call last):
2020-06-02T07:59:38.241366+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 210, in run
2020-06-02T07:59:38.241723+00:00 app[web.1]:     self.sleep()
2020-06-02T07:59:38.241728+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 360, in sleep
2020-06-02T07:59:38.241955+00:00 app[web.1]:     ready = select.select([self.PIPE[0]], [], [], 1.0)
2020-06-02T07:59:38.241960+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 245, in handle_chld
2020-06-02T07:59:38.242155+00:00 app[web.1]:     self.reap_workers()
2020-06-02T07:59:38.242156+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2020-06-02T07:59:38.242436+00:00 app[web.1]:     raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2020-06-02T07:59:38.242479+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2020-06-02T07:59:38.242485+00:00 app[web.1]: 
2020-06-02T07:59:38.242486+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2020-06-02T07:59:38.242486+00:00 app[web.1]: 
2020-06-02T07:59:38.242489+00:00 app[web.1]: Traceback (most recent call last):
2020-06-02T07:59:38.242515+00:00 app[web.1]:   File "/app/.heroku/python/bin/gunicorn", line 8, in <module>
2020-06-02T07:59:38.242642+00:00 app[web.1]:     sys.exit(run())
2020-06-02T07:59:38.242646+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 61, in run
2020-06-02T07:59:38.242786+00:00 app[web.1]:     WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2020-06-02T07:59:38.242790+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 223, in run
2020-06-02T07:59:38.242963+00:00 app[web.1]:     super(Application, self).run()
2020-06-02T07:59:38.242967+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 72, in run
2020-06-02T07:59:38.243100+00:00 app[web.1]:     Arbiter(self).run()
2020-06-02T07:59:38.243104+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 232, in run
2020-06-02T07:59:38.243269+00:00 app[web.1]:     self.halt(reason=inst.reason, exit_status=inst.exit_status)
2020-06-02T07:59:38.243274+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 345, in halt
2020-06-02T07:59:38.243478+00:00 app[web.1]:     self.stop()
2020-06-02T07:59:38.243482+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 393, in stop
2020-06-02T07:59:38.243692+00:00 app[web.1]:     time.sleep(0.1)
2020-06-02T07:59:38.243696+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 245, in handle_chld
2020-06-02T07:59:38.243865+00:00 app[web.1]:     self.reap_workers()
2020-06-02T07:59:38.243869+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2020-06-02T07:59:38.244116+00:00 app[web.1]:     raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2020-06-02T07:59:38.244120+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>```
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
scikit-learn==0.21.3

2020-06-02T07:59:38.012426+00:00 app[web.1]:     import sklearn.linear_model._logistic
2020-06-02T07:59:38.012470+00:00 app[web.1]: ModuleNotFoundError: No module named 'sklearn.linear_model._logistic'

Here is scikit-learn 0.21.x:
https://github.com/scikit-learn/scikit-learn/tree/0.21.X/sklearn/linear_model

Here is scikit-learn stable:
https://github.com/scikit-learn/scikit-learn/tree/master/sklearn/linear_model

Notice how in 0.21.x _logistic.py doesn't exist. On your working development environment do:
python3 -m pip freeze > requirements.txt


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...