I have been trying to use tensorflow to build a simple neural network using PyCharm. I have managed to install the tensorflow package(see image below) but the following error appears when I try to run the application.
Traceback (most recent call last): File "C:/Users/abc/Desktop/new-app/neuraln.py", line 1, in
import tensorflow as tf ModuleNotFoundError: No module named 'tensorflow'
I would really appreciate some help. Thanks!
Note - I'm not using conda env
Related
I want to install PyTorch 0.4.0 with cuda9.0 to use this repository.
However, after installing, when I try to import PyTorch by doing import torch, I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'torch'
I am following pytorch's official website to install the package. Here is the commands I used for installing pytorch:
conda install pytorch=0.4.0 cuda90 -c pytorch
i'm using anaconda environment, i've installed SpaCy lib, when i import this lib in terminal (spacy) it works with no error.
but when i use jupyter notebook in the same environemnt does'nt work, and shows this error:
***---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-76a01d9c502b> in <module>
----> 1 import spacy
ModuleNotFoundError: No module named 'spacy'***
can anyone help with this error!
So I have installed tensorflow with pip using pip install tensorflow==1.15 a few days ago, today I wanted to search for my models-master file and I didn't find it. I uninstalled tensorflow using pip uninstall tensorflow and then I installed it from the github and added it to the folder of the project I am working on like, it is in the same folder as the .py files of my original project. This is because I need to use protoc on the files because I got error messages before. I think I got the protoc part down now but I can't test it, because whenever I want to run my main file, I get this error message:
Traceback (most recent call last):
File "C:\Users\user\Desktop\captcha solver\main_.py", line 1, in <module>
from CAPTCHA_object_detection import *
File "C:\Users\user\Desktop\captcha solver\CAPTCHA_object_detection.py", line 18, in <module>
from object_detection.utils import ops as utils_ops
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\object_detection\utils\ops.py", line 291, in <module>
dtype=tf.float32):
AttributeError: module 'tensorflow' has no attribute 'float32'
I think this is because of the way I installed tensorflow, but I don't know what I did wrong, I have never installed modules without pip though.
About OC: Ubuntu 16.04 LTS x86_64; GRX CUDA 10.2; cudnn ... etc.
TF: 2.1.0; Python 3.6
About the problem:
When I launch module_main.py an error is displayed. When I launch it /legacy/train.py similarly, an error appears.
Is it possible to fix this problem without downgrading the tensorflow version and without reinstalling the drivers?
Is changing the code via a script the only way?
Logs below:
model_main.py
Traceback (most resent call last):
File "models/research/object_detection/model_main.py",
line 26, in <module> from object_detection import model_lib
File "/root/ObjectDetection/models/research/object_detection/model_lib.py"
line 27, in <module> from object_detection import eval_lib
File "/root/ObjectDetection/models/research/object_detection/eval_util.py",
line 40, in <module> slim = tf.contrib.slim
AttributeError: module 'tensorflow' has no attribute 'contrib'
Also using conda env
thx, for some advice
I faced the same issue. Tensorflow 2.0 has removed tf.contrib. I tried to fixed the error by changing the code. And it lead to many other error.
I fixed this issue by downgrading tensorflow to 1.14.0
Run these commands on terminal:
pip uninstall tensorflow
pip install tensorflow==1.14.0
I am using Ubuntu 16.04 with Python 2.7 and Tensorflow 1.4 installed in it. I am stuck with this Bazel script to pre-process text datasets for training i.e in this part of the link.
# Run the preprocessing script.
bazel-bin/skip_thoughts/data/preprocess_dataset \
--input_files=${INPUT_FILES} \
--output_dir=${DATA_DIR}
where I get this error,
$ bazel-bin/skip_thoughts/data/ preprocess_dataset --input_files="./skip_thoughts/dataset/*.txt" --output_dir="./skip_thoughts/data"
Traceback (most recent call last):
File "/home/code/skip_thoughts/bazel-bin/skip_thoughts/data/prep
rocess_dataset.runfiles/__main__/skip_thoughts/data/preprocess_dataset.py", line 43, in <module>
import tensorflow as tf
ImportError: No module named tensorflow
The error occurs only when I run the Bazel script and tensorflow works fine otherwise. Any suggestions on what might be wrong will be greatly appreciated!