no module named tensorflow - python

I installed tensorflow CPU version in windows as mentined on their official page.
It got installed successfully but giving error while I import the library.
Output for pip freeze also shows it's present:
spyder==3.1.2
SQLAlchemy==1.1.5
statsmodels==0.6.1
sympy==1.0
tables==3.2.2
tensorflow==1.0.1
toolz==0.8.2
tornado==4.4.2
traitlets==4.3.1
Using anaconda.

If you have python 2.X installed along with a Python 3.X do pip(version) example; pip3 instead of pip. I had a similar problem so i had a look around and someone said do pip3.6.1 but it spewed out an error so a few trys later pip3 worked. If not idk whats happening

Related

ImportError: DLL load failed while importing shell

Importing winshell (version 0.6) causes the following error:
>>> import winshell
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python39\lib\site-packages\winshell.py", line 32, in <module>
from win32com.shell import shell, shellcon
ImportError: DLL load failed while importing shell: The specified procedure could not be found.
I finally managed to get Anaconda to start working by executing the line:
pip install pywin32==300
I had to do it twice, because the first time it went for 301, not 300. The second time then dropped it to 300. This was from the Anaconda for Windows installer downloaded just two days ago from the Anaconda website and doing a "clean install"!
What a fiasco!
Until that point, NOTHING really worked. Almost every important command within Anaconda would fail with the Win32com error, and Navigator would not even start. Apparently the latest version of pywin32 is 304, but it doesn't work either. Is anyone looking into this? For a newbie like me, this is a very bad look for Anaconda as a tool! I was on the brink of simply giving up when I literally stumbled onto this thread.
Note that it has been MONTHS between my post and the one before mine. I'd say that this has probably caused a lot of people to simply give up (assuming that there are many who actually try to install this on Windows per month, that is).
I've had similar in the past,was about to give up on Anaconda.
Here's the solution
Apparently the wrong version of pywin32 gets installed.
I had the installed version 301 and after downgrading to 228 with pip install --upgrade pywin32==228 everything just started working.
Try pip install --upgrade pywin32==228
This should resolve the issue
Version 300 of pywin32 solved this issue for me! Check this other question for more info
Had the same issue with Conda and librosa in Python 3.9.
Librosa references from win32com.shell import shellcon,shell, which was causing the same error you received.
Installing pywin32 via conda fixed the error for me:
conda install -c conda-forge librosa
I ran into this issue when trying to get Anaconda to run at all on a new installation. I followed Alex T's recommendation to install version 300 of pywin32. Like him, I had to run it twice because it first installed version 302 for some reason. After running it the second time I can now run conda commands in that environment
pip install pywin32==300
My simple solution is to install an Older version of Anaconda. This worked perfectly for me. I installed Anaconda3-2021.11-Windows-x86 version.
The Newer Version of Anaconda has some problems with pywin32. I first tried the command :
pip install --upgrade pywin32==228
but It didn't workd for me. Installing an older version finally solved the problem of anaconda navigator not launching.

Pip installed a module I want to use, but still getting "module not found" error

I am trying to use the Python module Gdal. I have run pip install gdal and I recieve the message
Requirement already satisfied: gdal in c:\users\willy\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (3.3.1)
and yet when I run import gdal in my Python IDE (I use Spyder), I still get the error no module named gdal
You need to tell Spyder which Python interpreter to use. Point it to the one you're installing the package for, as it seems that it's using a different one.
https://docs.spyder-ide.org/current/faq.html#using-existing-environment
From the documentation it seems you have to call:
from osgeo import gdal
See here
Answer is here in Spyder docs: https://docs.spyder-ide.org/5/faq.html#using-packages-installer
Don't try to use pip install and expect it to work in Spyder. Follow these instructions

Having issue importing requests and I assume it's my python runtime not being set correctly

Probably stupidly I tried to install the latest version of Python, in this case using the download from python site, but after doing that I was then getting python still running on the previous version python-3.6. I'm on OSX and was using sublime.
So I have been trying to work out how to update it to use the newest version. I've followed; https://opensource.com/article/19/5/python-3-default-mac.
All of the responses to queries now point to the python-3.9.5 version. So that's great and my runtime is using that. However after installing the requests using pip install I get the following error when running.
import requests
ModuleNotFoundError: No module named 'requests'''
[path: /Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]
I stumbled upon Modules are installed using pip on OSX but not found when importing which I have been trying to work through.
I have been able to run the import command successfully in terminal, however it's intermittent as I've tried again and it's broken, so I'm lost. I'm running it something trying to run the python3.6 version, which after updating I followed these instructions to remove when I have uninstalled that from my mac https://www.macupdate.com/app/mac/5880/python/uninstall.
If there is any ideas, would love some help, mainly to try and tell me what that error message is telling me.
In particular, what does this mean?
[path: /Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.6/
I should clarify too; when I run 'pip list'
I see
requests 2.25.1
Assuming that you are not installing requests package properly, and assuming your python executable is named python:
python -m pip install requests
If however, your python executable is named something else instead, e.g. python3, replace python with that name:
python3 -m pip install requests

Error importing tensorflow (just installed) python 3.7

I have python 3.7 installed on a Windows 10 machine, no custom stuff at all, to install tensorflow I used:
pip3 install --user --upgrade tensorflow
but when I try importing it using:
import tensorflow
in a python script or shell it gives me the following error:
ImportError: DLL load failed: The specified module could not be found.
Am I doing something wrong?
edit: By the way pip version is 20.0.2, I precedently tried with pip 10.x and got the same result.
Regarding https://github.com/tensorflow/tensorflow/issues/35749 or https://github.com/tensorflow/tensorflow/issues/36859 (and the amount of same duplicate issues) there are some recents problems with tensorflow 2.1 for some windows computers.
A fix so far, is to use tensorflow 2.0 on windows :
pip install tensorflow==2.0
For more details, this is quite detailed : https://github.com/tensorflow/tensorflow/issues/36167#issuecomment-577886156

Importing matplotlib returns "ModuleNotFoundError" after installing matplotlib with pip

I'm trying to display data using a pie chart in python, so i tried to install matplotlib using pip. After doing that, I tried importing matplotlib but I get an error: ModuleNotFoundError: No module named 'matplotlib'.
In the Command Prompt I typed 'pip install matplotlib' and everything appeared to be successful. This is the last line:
Successfully installed backports.functools-lru-cache-1.5 cycler-0.10.0 kiwisolver-1.0.1 matplotlib-2.2.4 numpy-1.16.2 pyparsing-2.3.1 python-dateutil-2.8.0 pytz-2018.9 six-1.12.0
I've also tried 'python -m pip install -U matplotlib', but I still get a ModuleNotFoundError.
I've tried running the input statement in both python 3 and 2, neither worked.
I've looked at various different discussions on this, and none of them seemed to help me. How can I fix this?
There are various python installed in your OS. If you install matplotlib for somewhere the python that you are using does not search, you get importing errors. You should figure out which python you want to use and where the packages it searches.
check your python path. the matplotlib should be installed in the same path with your python environment.
I guess you use an IDE to run the python. some IDE have their own python environment.
if not solved. plz introduce some details about your system、how installed etc.

Categories