I am using Windows 10 OS, Python Version - 3.8
Installed Method - conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
It was successfully installed, when trying to run torch.cuda.is_available() throws up an error as -
AttributeError: partially initialized module 'torch' has no attribute 'cuda' (most likely due to a circular import)
I faced this error other importing such as -torch.nn as nn-
I checked the package list (!pip list ) it is present
Why I can't use pytoch on spyder ? How to tackle this problem ?
I think you have a file named torch.py in your working directory
Please rename it to something else
Related
I was able to install xgboost on my mac and have it so that I can import the module without any errors. However I cannot use it. When I try to import XGBRegressor. I get the following error :
cannot import name 'XGBRegressor' from 'xgboost' (unknown location).
Some of the support for this type of problem says that there may be more than one xgboost location, and that python is selecting the incorrect xgboost, however I have not been able to find how to fix this problem.
When I print the xgboost.__file__ location, it returns 'None'. However I know its in the site-packages folder in my python path.
I have python 3.9
Maybe this.
conda install -c conda-forge xgboost=0.6a2
Then, restart Spyder and re-run!
I am trying to install plaidml-keras so I can use non-Nvidia GPUs with Keras in python/jupyter. After clearing several other hurdles I get as far as:
plaidbench keras mobilenet
but it errors twice
ImportError: cannot import name 'object_list_uid' from 'keras.utils.generic_utils' (/Users/me/sprinthive/src/notebooks/nbenv/lib/python3.7/site-packages/keras/utils/generic_utils.py)
File "/Users/me/sprinthive/src/notebooks/nbenv/lib/python3.7/site-packages/plaidbench/frontend_keras.py", line 321, in __init__
raise core.ExtrasNeeded(['plaidml-keras'])
plaidbench.core.ExtrasNeeded: Missing needed packages for benchmark; to fix, pip install plaidml-keras
This is in spite of already having plaidml-keras installed:
pip freeze | grep plaid
plaidbench==0.6.4
plaidml==0.6.4
plaidml-keras==0.6.4
[I am using 0.6.4 to make it work on macOS 10.13 High Sierra]
How can I resolve the above errors?
Thanks!
I worked this out by creating a virtual environment with Anaconda. Beware that i am working on Windows, so this might not be a solution for your problem. If i had to guess, something was installed by me before that causes a python package problem. I think this is related to the tensorflow library, but i haven't dug into that. I would recommend trying out a fresh virtual environment on your Mac, where you install the plaidml package. The error Message before was exactly the same.
I have seen this problem happen recurrently, though none of the solutions are fully relevant to me. I have installed Tensorflow as :
conda create -n tensorflow_env tensorflow
conda activate tensorflow_env
Then I changed to this tensorflow_env inside Anaconda Navigator(gui), and installed Spyder there. Now inside Spyder I am getting this error while importing tensorflow:
ModuleNotFoundError Traceback (most recent call last)
in----> 1 import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
1) Python version(used by Spyder) is Python 3.7.6. I should mention that doing print(sys.executable) inside and outside the conda environment mention different paths.
2) I have seen this exact installation procedure work for Ubuntu 16.04 LTS.
Can someone please help in troubleshooting this?
I am trying to get jupyterlab working using an environment handled by miniconda. However, starting from a fresh environment using python 3.8.0 and simply doing
conda install -c conda-forge jupyterlab
First lead me to an asyncio related error. I was able to solve it using this answer.
Now I am facing a DLL import error :
File "C:\Users\XXXX\AppData\Local\Continuum\miniconda3\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
And I can't solve this. I tried using python 3.6.0 instead of 3.8.0. This did not work.
Any idea ? I am using Windows 10 build 1809 64 bits system.
I am trying to run tensorboard but I am getting the following import error;
AttributeError: module 'pkg_resources' has no attribute 'declare_namespace'
I have tried reinstalling setuptools and distribute. This is for Python3.5.
This stacktrace is going into the Protobuf codebase so this doesn't look like a bug in TensorFlow. It looks like something is wrong with the setuptools on your system. Maybe try reinstalling it? You can also try installing TensorFlow inside a virtualenv.
See also: https://github.com/tensorflow/tensorflow/issues/6863