I am having this error, even after "pip install translate" multiple times.
I am running my application in a docker container. I am a beginner , so please let me know, what mistake i am doing.
`
Traceback (most recent call last):
File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/dist-packages/uvicorn/_subprocess.py", line 76, in subprocess_started
target(sockets=sockets)
File "/usr/local/lib/python3.10/dist-packages/uvicorn/server.py", line 60, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/usr/local/lib/python3.10/dist-packages/uvicorn/server.py", line 67, in serve
config.load()
File "/usr/local/lib/python3.10/dist-packages/uvicorn/config.py", line 477, in load
self.loaded_app = import_from_string(self.app)
File "/usr/local/lib/python3.10/dist-packages/uvicorn/importer.py", line 24, in import_from_string
raise exc from None
File "/usr/local/lib/python3.10/dist-packages/uvicorn/importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/usr/./main.py", line 8, in <module>
from translate import Translator
ModuleNotFoundError: No module named 'translate'
when I am running "python3 -m pip install translate"
Requirement already satisfied: translate in /root/anaconda3/envs/newenvt1/lib/python3.9/site-packages (3.6.1)
Requirement already satisfied: click in /root/anaconda3/envs/newenvt1/lib/python3.9/site-packages (from translate) (8.0.4)
Requirement already satisfied: libretranslatepy==2.1.1 in /root/anaconda3/envs/newenvt1/lib/python3.9/site-packages (from translate) (2.1.1)
Requirement already satisfied: lxml in /root/anaconda3/envs/newenvt1/lib/python3.9/site-packages (from translate) (4.9.1)
Requirement already satisfied: requests in /root/anaconda3/envs/newenvt1/lib/python3.9/site-packages (from translate) (2.28.1)
Requirement already satisfied: charset-normalizer<3,>=2 in /root/anaconda3/envs/newenvt1/lib/python3.9/site-packages (from requests->translate) (2.0.4)
Requirement already satisfied: idna<4,>=2.5 in /root/anaconda3/envs/newenvt1/lib/python3.9/site-packages (from requests->translate) (2.10)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /root/anaconda3/envs/newenvt1/lib/python3.9/site-packages (from requests->translate) (1.26.12)
Requirement already satisfied: certifi>=2017.4.17 in /root/anaconda3/envs/newenvt1/lib/python3.9/site-packages (from requests->translate) (2022.9.24)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
`
When I did "pip list", translate is there but still this error is coming.
You need not local pip install, but install in your docker.
Add to Dockerfile
python3 -m pip install translate
And rebuild your image
Related
I am trying to run a django app which is made by some other developer. First I got *ModuleNotFoundError: No module named 'django_heroku'*That was solved by pip install django-heroku. Now I am getting this error.
ModuleNotFoundError: No module named 'bootstrap5'
Then I did this
pip install django-bootstrap5
It looks like it installed bootstrap5. But when I try to run again the app I am getting same error.Here is the what it shows.
(venv) D:\django\multi-vendor-shop-management-main>python manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Python39\lib\threading.py", line 973, in _bootstrap_inner
self.run()
File "C:\Python39\lib\threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "D:\django\venv\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "D:\django\venv\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
autoreload.raise_last_exception()
File "D:\django\venv\lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "D:\django\venv\lib\site-packages\django\core\management\__init__.py", line 398, in execute
autoreload.check_errors(django.setup)()
File "D:\django\venv\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "D:\django\venv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "D:\django\venv\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "D:\django\venv\lib\site-packages\django\apps\config.py", line 228, in create
import_module(entry)
File "C:\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'bootstrap5'
When I do pip install django-bootstrap5 again, It gives me this
(venv) D:\django>pip install django-bootstrap5
Requirement already satisfied: django-bootstrap5 in d:\django\venv\lib\site-packages (21.3)
Requirement already satisfied: Django>=2.2 in d:\django\venv\lib\site-packages (from django-bootstrap5) (4.0.4)
Requirement already satisfied: beautifulsoup4>=4.8.0 in d:\django\venv\lib\site-packages (from django-bootstrap5) (4.11.1)
Requirement already satisfied: soupsieve>1.2 in d:\django\venv\lib\site-packages (from beautifulsoup4>=4.8.0->django-bootstrap5) (2.3.2.post1)
Requirement already satisfied: sqlparse>=0.2.2 in d:\django\venv\lib\site-packages (from Django>=2.2->django-bootstrap5) (0.4.2)
Requirement already satisfied: tzdata in d:\django\venv\lib\site-packages (from Django>=2.2->django-bootstrap5) (2022.1)
Requirement already satisfied: asgiref<4,>=3.4.1 in d:\django\venv\lib\site-packages (from Django>=2.2->django-bootstrap5) (3.5.1)
WARNING: You are using pip version 21.2.3; however, version 22.1 is available.
You should consider upgrading via the 'D:\django\venv\Scripts\python.exe -m pip install --upgrade pip' command.
What can I do now? I am new to django.
The preferred way to install django-bootstrap-v5 is:
$ pip install django-bootstrap-v5
According to documentation
I am trying to migrate my Django database after installing django_plotly_dash and am receiving this error even though I have dash installed and working fine. Any ideas why this will not work when I try it with Django?
Command:
C:\Users\xxx\Python\Price Tracking\Django\mysite>python manage.py migrate
Installing dash:
C:\Users\xxx>pip install --trusted-host=pypi.org --trusted-host=files.pythonhosted.org dash
Requirement already satisfied: dash in c:\python38\lib\site-packages (1.12.0)
Requirement already satisfied: Flask>=1.0.2 in c:\python38\lib\site-packages (from dash) (1.1.2)
Requirement already satisfied: flask-compress in c:\python38\lib\site-packages (from dash) (1.5.0)
Requirement already satisfied: plotly in c:\python38\lib\site-packages (from dash) (4.7.1)
Requirement already satisfied: dash_renderer==1.4.1 in c:\python38\lib\site-packages (from dash) (1.4.1)
Requirement already satisfied: dash-core-components==1.10.0 in c:\python38\lib\site-packages (from dash) (1.10.0)
Requirement already satisfied: dash-html-components==1.0.3 in c:\python38\lib\site-packages (from dash) (1.0.3)
Requirement already satisfied: dash-table==4.7.0 in c:\python38\lib\site-packages (from dash) (4.7.0)
Requirement already satisfied: future in c:\python38\lib\site-packages (from dash) (0.18.2)
Requirement already satisfied: itsdangerous>=0.24 in c:\python38\lib\site-packages (from Flask>=1.0.2->dash) (1.1.0)
Requirement already satisfied: Werkzeug>=0.15 in c:\python38\lib\site-packages (from Flask>=1.0.2->dash) (1.0.1)
Requirement already satisfied: Jinja2>=2.10.1 in c:\python38\lib\site-packages (from Flask>=1.0.2->dash) (2.11.2)
Requirement already satisfied: click>=5.1 in c:\python38\lib\site-packages (from Flask>=1.0.2->dash) (7.1.2)
Requirement already satisfied: MarkupSafe>=0.23 in c:\python38\lib\site-packages (from Jinja2>=2.10.1->Flask>=1.0.2->dash) (1.1.1)
Requirement already satisfied: brotli in c:\python38\lib\site-packages (from flask-compress->dash) (1.0.7)
Requirement already satisfied: six in c:\python38\lib\site-packages (from plotly->dash) (1.14.0)
Requirement already satisfied: retrying>=1.3.3 in c:\python38\lib\site-packages (from plotly->dash) (1.3.3)
Error:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Python38\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Python38\lib\site-packages\django\core\management\__init__.py", line 377, in execute
django.setup()
File "C:\Python38\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Python38\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Python38\lib\site-packages\django\apps\config.py", line 116, in create
mod = import_module(mod_path)
File "C:\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Python38\lib\site-packages\django_plotly_dash\__init__.py", line 31, in <module>
from .dash_wrapper import DjangoDash
File "C:\Python38\lib\site-packages\django_plotly_dash\dash_wrapper.py", line 32, in <module>
from dash import Dash
ImportError: cannot import name 'Dash' from 'dash' (C:\Users\xxxx\AppData\Roaming\Python\Python38\site-packages\dash\__init__.py)```
It looks like where it installs Dash:
c:\python38\lib\site-packages
is not where it's looking for Dash:
ImportError: cannot import name 'Dash' from 'dash' (C:\Users\xxxx\AppData\Roaming\Python\Python38\site-packages\dash\__init__.py)
This looks like a Python pathname issue. It should work if you can either get it to install to the same place it's looking, or change where it's looking to the place where it's being installed.
I have used Keras remotely, such as on Colab and AWS. Today, I tried to install Keras on my laptop using pip3 install keras, and the message was that keras was already installed on the computer (I must have installed it before):
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Requirement already satisfied: keras in /usr/local/lib/python3.7/site-packages/Keras-2.4.3-py3.7.egg (2.4.3)
Requirement already satisfied: h5py in /usr/local/lib/python3.7/site-packages/h5py-2.10.0-py3.7-macosx-10.15-x86_64.egg (from keras) (2.10.0)
Requirement already satisfied: numpy>=1.9.1 in /usr/local/lib/python3.7/site-packages (from keras) (1.16.4)
Requirement already satisfied: pyyaml in /usr/local/lib/python3.7/site-packages/PyYAML-5.3.1-py3.7-macosx-10.15-x86_64.egg (from keras) (5.3.1)
Requirement already satisfied: scipy>=0.14 in /usr/local/lib/python3.7/site-packages (from keras) (1.2.0)
Requirement already satisfied: six in /usr/local/lib/python3.7/site-packages (from h5py->keras) (1.12.0)
However, when I tried to import keras, I received this message:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3267, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-21-88d96843a926>", line 1, in <module>
import keras
ModuleNotFoundError: No module named 'keras'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 2018, in showtraceback
stb = value._render_traceback_()
AttributeError: 'ModuleNotFoundError' object has no attribute '_render_traceback_'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/IPython/core/ultratb.py", line 1095, in get_records
return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
File "/usr/local/lib/python3.7/site-packages/IPython/core/ultratb.py", line 313, in wrapped
return f(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/IPython/core/ultratb.py", line 347, in _fixed_getinnerframes
records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/inspect.py", line 1502, in getinnerframes
frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/inspect.py", line 1460, in getframeinfo
filename = getsourcefile(frame) or getfile(frame)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/inspect.py", line 696, in getsourcefile
if getattr(getmodule(object, filename), '__loader__', None) is not None:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/inspect.py", line 733, in getmodule
if ismodule(module) and hasattr(module, '__file__'):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/__init__.py", line 50, in __getattr__
module = self._load()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/__init__.py", line 32, in <module>
from tensorflow._api.v1 import app
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/_api/v1/app/__init__.py", line 10, in <module>
from tensorflow.python.platform.app import run
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/platform/app.py", line 23, in <module>
from absl.app import run as _run
ModuleNotFoundError: No module named 'absl'
I Googled to find similar problems and I found some suggestions to try sudo pip3 install keras. Keras was downloaded again. However, when I typed import keras, it still produced errors.
Also, I read this Stack Overflow question: How to fix import keras error with python console, but the solution does not work for me as I am calling a library which calls import keras, so I need the import keras command to work (I can't make it call import tensorflow.keras).
Why is this error happening?
Note: I am using Python 3.7.5. I checked the version of pip through pip --version, getting this message:
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
pip 20.0.2 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
Also, I am running this code in Jupyter Notebook. I have checked that Python 3.7 is being run by Jupyter Notebook.
Try installing tensorflow first:
pip install tensorflow
Then access keras via tensorflow
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
import tensorflow as tf
Make sure you're running your script with python3. Macs and some other computers come with Python 2.7 installed as the default for python, which will bamboozle you daily.
If that doesn't work, set up a virtual environment: Using Python 3 in virtualenv
This question already has answers here:
Issue installing Tensorflow -- not a CUDA/CuDNN issue
(4 answers)
Closed 4 years ago.
When I first used $ pip install --upgrade tensorflow, I was unable to install it. After looking around on multiple sites, I realized that it was because I had installed the x32-bit version of Python, not the x64-bit. After uninstalling the old Python and installing the new one, I was able to install tensorflow. This was the output:
C:\Users\Seth>pip install --upgrade tensorflow --user
Collecting tensorflow
Using cached https://files.pythonhosted.org/packages/0e/2a/c3fe6035f0a8726e5b210680af3ccaf826f4a64ce7306e57017aba749447/tensorflow-1.10.0-cp36-cp36m-win_amd64.whl
Collecting six>=1.10.0 (from tensorflow)
Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting absl-py>=0.1.6 (from tensorflow)
Using cached https://files.pythonhosted.org/packages/a7/86/67f55488ec68982270142c340cd23cd2408835dc4b24bd1d1f1e114f24c3/absl-py-0.4.1.tar.gz
Collecting gast>=0.2.0 (from tensorflow)
Using cached https://files.pythonhosted.org/packages/5c/78/ff794fcae2ce8aa6323e789d1f8b3b7765f601e7702726f430e814822b96/gast-0.2.0.tar.gz
Requirement already satisfied, skipping upgrade: setuptools<=39.1.0 in c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages (from tensorflow) (39.0.1)
Collecting wheel>=0.26 (from tensorflow)
Using cached https://files.pythonhosted.org/packages/81/30/e935244ca6165187ae8be876b6316ae201b71485538ffac1d718843025a9/wheel-0.31.1-py2.py3-none-any.whl
Collecting protobuf>=3.6.0 (from tensorflow)
Using cached https://files.pythonhosted.org/packages/e8/df/d606d07cff0fc8d22abcc54006c0247002d11a7f2d218eb008d48e76851d/protobuf-3.6.1-cp36-cp36m-win_amd64.whl
Collecting astor>=0.6.0 (from tensorflow)
Using cached https://files.pythonhosted.org/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl
Collecting tensorboard<1.11.0,>=1.10.0 (from tensorflow)
Using cached https://files.pythonhosted.org/packages/c6/17/ecd918a004f297955c30b4fffbea100b1606c225dbf0443264012773c3ff/tensorboard-1.10.0-py3-none-any.whl
Collecting grpcio>=1.8.6 (from tensorflow)
Using cached https://files.pythonhosted.org/packages/65/da/03e722b7981ab3222f292f735a3c157b1d1bca120c479d7e273273828170/grpcio-1.14.2-cp36-cp36m-win_amd64.whl
Collecting termcolor>=1.1.0 (from tensorflow)
Using cached https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
Collecting numpy<=1.14.5,>=1.13.3 (from tensorflow)
Using cached https://files.pythonhosted.org/packages/0d/b7/0c804e0bcba6505f8392d042d5e333a5e06f308e019517111fbc7767a0bc/numpy-1.14.5-cp36-none-win_amd64.whl
Collecting markdown>=2.6.8 (from tensorboard<1.11.0,>=1.10.0->tensorflow)
Using cached https://files.pythonhosted.org/packages/6d/7d/488b90f470b96531a3f5788cf12a93332f543dbab13c423a5e7ce96a0493/Markdown-2.6.11-py2.py3-none-any.whl
Collecting werkzeug>=0.11.10 (from tensorboard<1.11.0,>=1.10.0->tensorflow)
Using cached https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl
Installing collected packages: six, absl-py, gast, wheel, protobuf, astor, numpy, markdown, werkzeug, tensorboard, grpcio, termcolor, tensorflow
Running setup.py install for absl-py ... done
Running setup.py install for gast ... done
The script wheel.exe is installed in 'C:\Users\Seth\AppData\Roaming\Python\Python36\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The script markdown_py.exe is installed in 'C:\Users\Seth\AppData\Roaming\Python\Python36\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The script tensorboard.exe is installed in 'C:\Users\Seth\AppData\Roaming\Python\Python36\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Running setup.py install for termcolor ... done
The scripts freeze_graph.exe, saved_model_cli.exe, tensorboard.exe, tflite_convert.exe, toco.exe and toco_from_protos.exe are installed in 'C:\Users\Seth\AppData\Roaming\Python\Python36\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed absl-py-0.4.1 astor-0.7.1 gast-0.2.0 grpcio-1.14.2 markdown-2.6.11 numpy-1.14.5 protobuf-3.6.1 six-1.11.0 tensorboard-1.10.0 tensorflow-1.10.0 termcolor-1.1.0 werkzeug-0.14.1 wheel-0.31.1
I thought it had worked until I imported it in a program. This was the result of that:
>>> import tensorflow as tf
Traceback (most recent call last):
File "C:\Users\Seth\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Seth\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Seth\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Seth\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 16, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
import tensorflow as tf
File "C:\Users\Seth\AppData\Roaming\Python\Python36\site-packages\tensorflow\__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\Seth\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Seth\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Seth\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Seth\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Seth\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Seth\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 16, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
What did I do wrong?
Download Anaconda. It comes with installed tensorflow and other libraries. Check out this website
SOLUTION
Thank you P-Gn for marking this as a duplicate. I would not have found the answer otherwise. Tensorflow works in version 1.5 for me, but I will probably have to find a way to get 1.10 working.
Im trying to install the google-cloud python package, and I encounter the foloowing meesage whenn the installation fails:
pip install --upgrade google-cloud
Collecting google-cloud
Using cached google_cloud-0.23.0-py2.py3-none-any.whl
Collecting google-cloud-dns<0.24dev,>=0.23.0 (from google-cloud)
Using cached google_cloud_dns-0.23.0-py2.py3-none-any.whl
Collecting google-cloud-monitoring<0.24dev,>=0.23.0 (from google-cloud)
Using cached google_cloud_monitoring-0.23.0-py2.py3-none-any.whl
Collecting google-cloud-error-reporting<0.24dev,>=0.23.0 (from google-cloud)
Using cached google_cloud_error_reporting-0.23.2-py2.py3-none-any.whl
Collecting google-cloud-bigquery<0.24dev,>=0.23.0 (from google-cloud)
Using cached google_cloud_bigquery-0.23.0-py2.py3-none-any.whl
Collecting google-cloud-bigtable<0.24dev,>=0.23.0 (from google-cloud)
Using cached google_cloud_bigtable-0.23.1-py2.py3-none-any.whl
Collecting google-cloud-runtimeconfig<0.24dev,>=0.23.0 (from google-cloud)
Using cached google_cloud_runtimeconfig-0.23.0-py2.py3-none-any.whl
Collecting google-cloud-pubsub<0.24dev,>=0.23.0 (from google-cloud)
Using cached google_cloud_pubsub-0.23.0-py2.py3-none-any.whl
Collecting google-cloud-datastore<0.24dev,>=0.23.0 (from google-cloud)
Using cached google_cloud_datastore-0.23.0-py2.py3-none-any.whl
Collecting google-cloud-core<0.24dev,>=0.23.1 (from google-cloud)
Using cached google_cloud_core-0.23.1-py2.py3-none-any.whl
Collecting google-cloud-resource-manager<0.24dev,>=0.23.0 (from google-cloud)
Using cached google_cloud_resource_manager-0.23.0-py2.py3-none-any.whl
Collecting google-cloud-vision<0.24dev,>=0.23.0 (from google-cloud)
Using cached google_cloud_vision-0.23.3-py2.py3-none-any.whl
Collecting google-cloud-translate<0.24dev,>=0.23.0 (from google-cloud)
Using cached google_cloud_translate-0.23.0-py2.py3-none-any.whl
Collecting google-cloud-logging<0.24dev,>=0.23.0 (from google-cloud)
Using cached google_cloud_logging-0.23.1-py2.py3-none-any.whl
Collecting google-cloud-language<0.24dev,>=0.23.0 (from google-cloud)
Using cached google_cloud_language-0.23.1-py2.py3-none-any.whl
Collecting google-cloud-speech<0.24dev,>=0.23.0 (from google-cloud)
Using cached google_cloud_speech-0.23.0-py2.py3-none-any.whl
Collecting google-cloud-spanner<0.24dev,>=0.23.1 (from google-cloud)
Using cached google_cloud_spanner-0.23.1-py2.py3-none-any.whl
Collecting google-cloud-storage<0.24dev,>=0.23.0 (from google-cloud)
Using cached google_cloud_storage-0.23.1-py2.py3-none-any.whl
Collecting gapic-google-cloud-error-reporting-v1beta1<0.16dev,>=0.15.0 (from google-cloud-error-reporting<0.24dev,>=0.23.0->google-cloud)
Using cached gapic-google-cloud-error-reporting-v1beta1-0.15.3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\setuptools\__init__.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\setuptools\extern\__init__.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2927, in <module>
File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2913, in _call_aside
File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2952, in _initialize_master_working_set
File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 956, in subscribe
File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2952, in <lambda>
File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2515, in activate
File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2097, in declare_namespace
File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2047, in _handle_ns
File "c:\anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2066, in _rebuild_mod_path
AttributeError: '_NamespacePath' object has no attribute 'sort'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\OFIRAR~1\AppData\Local\Temp\pip-build-j5a_32a2\gapic-google-cloud-error-reporting-v1beta1\
what could cause this? I installed other packages without problems.
Since I cannot comment, I will answer it here.
I had this issue once. I fixed it by doing the following:
pip install --upgrade pip
pip install --upgrade setuptools
Some discussions relate this to an issue with Python 3*, and others with the version of pip.
If upgrading pip and setuptools does not work for you, try using Python 2.7*.
I have tested on my machine using Python 2.7.13 with pip v9.0.1.
Though this is a known issue, it has been discussed here and here
Well if you are using python 3.6 this issue can be solved by following steps
1) pip install --upgrade pip setuptools
2) pip install --upgrade google-cloud-datastore
For me it worked.
Thank you