I have this python code when I run it ,it say
AttributeError: module 'cupy' has no attribute 'cupyx'
code:
# upload matrix and inverse diagonal GPU
A = cp.cupyx.scipy.sparse.csr_matrix(A)
I've installed cupy successfully in docker using
pip install cupy-cuda100
any help will be appreciated, thx
See the discussion in https://github.com/cupy/cupy/issues/2654 and try the following
import cupyx.scipy.sparse
cupyx.scipy.sparse.csr_matrix(A)
The alias cupy.cupyx was unintentionally there in some prereleases, but it has been removed because it is too confusing.
Related
Code:
import graphing
graphing.scatter_2D(dataset, label_x="harness_size",
label_y="boot_size",
trendline=lambda x: fitted_model.params[1] * x + fitted_model.params[0]
)
Why do I have this error:
module 'graphing' has no attribute 'scatter_2D'
It's from an Azure course.
Try to install the library, it's okay for this.
In the very first cell, there was a line:
!wget https://raw.githubusercontent.com/MicrosoftDocs/mslearn-introduction-to-machine-learning/main/graphing.py
The Graphing.py file has a method defined as scatter_2D. If you are running this on your jupyter notebook, wget needs to be installed.
Edited: Or follow #wayne instructions from comment below
I am very new to sentiment analysis. Trying to use Stanford Sentiment Treebank(sst) and ran into an error.
from nltk.tree import Tree
import os
import sst
trees = "C:\\Users\m\data\trees"
tree, score = next(sst.train_reader(trees))
[Output]:
AttributeError Traceback (most recent call last)
<ipython-input-19-4101f90b0b16> in <module>()
----> 1 tree, score = next(sst.train_reader(trees))
AttributeError: module 'sst' has no attribute 'train_reader'
I think you're looking for https://github.com/JonathanRaiman/pytreebank, not https://pypi.org/project/sst/.
On the python side, that error is pretty clear. Once you import the right package, though, I'm not sure I saw train_reader but I could be wrong.
UPDATE:
I'm not entirely sure why you're running into the 'sst' not having the attribute train_reader. Make sure you didn't accidentally install the 'sst' package if you're using conda. It looks like the 'sst' is referring to a privately created module and that one should work.
I got your import working but what I did was I:
Installed everything specified in the requirements.txt file.
import sst was still giving me an error so I installed nltk and sklearn to resolve that issue. (fyi, im not using conda. im just using pip and virtualenv for my own private package settings. i ran pip install nltk and pip install sklearn)
At this point, import sst worked for me.
I guess you're importing the sst package selenium-simple-test, which is not what you're looking for.
Try sst.discover() , if you get the error
TypeError: discover() missing 4 required positional arguments: 'test_loader', 'package', 'dir_path', and 'names'
You are using the selenium-simple-test package
I'm running these lines
import dill
dill.load_session("session2.pkl")
and getting the error AttributeError: module 'IPython.core' has no attribute 'shadowns'.
I've saved this session on Google Colab Notebooks. How can I get rid of the error?
I used the simple workaround:
import IPython
IPython.core.shadowns = 1
For some extra packages missing like google or google.colab, I used
%%bash
mkdir google/colab
touch google/colab/__init__.py
I need to perform a BULK whois query using shodan API.
I came across this code
import shodan
api = shodan.Shodan('inserted my API-KEY- within single quotes')
info = api.host('8.8.8.8')
After running the module i get the following error:
Traceback (most recent call last):
File "C:/Users/PIPY/AppData/Local/Programs/Python/Python37/dam.py", line 1, in
import shodan
File "C:/Users/PIPY/AppData/Local/Programs/Python/Python37\shodan.py", line 2, in
api = shodan.Shodan('the above insereted API KEY')
AttributeError: module 'shodan' has no attribute 'Shodan'
I'm learning python and have limited scripting/programming experience.
Could you please help me out?
Cheers
You seem to have dam.py and shodan.py – Python defaults to importing from the module directory, so the installed shodan package gets masked.
Try renaming shodan.py to e.g. shodan_test.py (and of course fixing up any imports, etc.).
I have solved the issue by re-installing the shodan module under the C:\Users\PIPY\AppData\Local\Programs\Python\Python37\Scripts>pip install shodan
Thank you for the help AKX.
I had this same issue but after renaming my file as something different than shodan.py, I had to also delete the compiled class shodan.pyc to avoid the error.
Also, if you have more than one version of python installed, i.e. python2 and python3, use
python -m pip install shodan instead of pip install shodan, to ensure that you are installing the library in the same version of shodan that you are using to execute your script.
If you are executing your script with python3 shodan_test.py then use python3 -m pip install shodan
My goal is to acquire image from an Allied Vision camera thanks to Python (Anaconda 3.7). For that I tried to use the "Pymba" package but I get the error : “AttributeError: module has no attribute”.
I looked in the previous posts but I didn't find any working solution. I put below some of my tests.
Here is my code :
import pymba
with pymba.Vimba() as vimba:
print (vimba.getVersion())
system = vimba.getSystem()
The precise error :
File "<ipython-input-2-ff80570a1f3d>", line 3, in <module>
print (vimba.getVersion())
AttributeError: 'Vimba' object has no attribute 'getVersion'
And here are some informations that could be usefull about my research to solve this problem:
I checked if the package was correctly installed.
from pymba import Vimba, PYMBA_VERSION
print(PYMBA_VERSION)
print(Vimba.version())
0.3.2
1.7.0
Despite the fact that I don't have any other file named "Pymba", I checked what file was imported:
print(pymba.__file__)
C:\Users\agricultu\Anaconda3\lib\site-packages\pymba\__init__.py
I don't have either a previous file named "getVersion" and I get the same error for every other function of the package anyway.
I'm running out of ideas and I hope one of you will be able to help me.