Getting numpy error when using azureml-sdk - python

hy I followed the installation instructions here
and installed with
pip install --upgrade azureml-sdk[notebooks,automl] azureml-dataprep --ignore-installed PyYAML
It seem to work but a simple
import azureml.core
azureml.core.VERSION
Throws me a numpy error
> AttributeError Traceback (most recent call
> last) <ipython-input-3-08b704cd5542> in <module>
> ----> 1 import azureml.core
> 2 azureml.core.VERSION
c:\users\werth\appdata\local\continuum\anaconda3\envs\azuresdk\lib\site-packages\azureml\core\__init__.py in <module>
4
5 """Setup file for core package."""
----> 6 from azureml.core.workspace import Workspace
7 from azureml.core.experiment import Experiment
8 from azureml.core.runconfig import RunConfiguration
... I did not include the total traceback as it is apparently a Azure import problem.
AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__'
It seems that the workspace has a problem. But I cannot think why. The Notebook is in a subfolder of the working directory. Numpy is installed.
If you would have an idea I would be thankfull.

Hi greatest Floridaman,
the answer is simple. During the installation of the azureml-train-automl 1.0.8 package, the numpy package needs to be maximum at version 1.15.0
So just downgrade numpy to that version
conda install numpy=1.15.0

Related

CHEMBL : Can't import new_client from chembl_webresource_client.new_client

I have installed the chembl_webresource_client package.
Then I tried to import a module from the package:
from chembl_webresource_client.new_client import new_client
But it fails to execute and this error appears:
ImportError Traceback (most recent call
last) in ()
1 # Import necessary libraries
2 import pandas as pd
----> 3 from chembl_webresource_client.new_client import new_client
4 frames
/usr/local/lib/python3.7/dist-packages/chembl_webresource_client/cache.py
in ()
1 author = 'mnowotka'
2
----> 3 from requests_cache.backends.base import BaseCache, hashlib, _to_bytes
4
5 def create_key(self, request):
ImportError: cannot import name 'hashlib' from
'requests_cache.backends.base'
(/usr/local/lib/python3.7/dist-packages/requests_cache/backends/base.py)
Is there a fix for this?
I have faced the same issue today and resolved it by updating chembl-webresource-client library's version from 0.10.2 to 0.10.3 in my project's requirements.txt file.
For example: chembl-webresource-client==0.10.3
Also after making these changes and activating your project's virtual environment, please don't forget to fetch and re-install all listed libraries in your requirements.txt using the following command:
pip install -r .\requirements.txt

Submodule import not working on Google Colab

I have a package called boo which I install on google colab from a github repository. The installation process looks fine and results in success message Successfully installed boo-0.1. However import boo fails on first internal import.
I replicated the same installation steps in a local virtual environment and package worked, but not on collab.
Here are my steps and error trace:
!rm -rf sandbox
!git clone https://github.com/ru-corporate/sandbox.git
!pip install -r sandbox/requirements.txt
!pip install sandbox/.
Alternatively, I tried
!pip install git+https://github.com/ru-corporate/sandbox.git#master
The error trace is:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-7-fc0b1d036b35> in <module>()
----> 1 import boo
/usr/local/lib/python3.6/dist-packages/boo/__init__.py in <module>()
----> 1 from boo.boo import download, build, read_dataframe, files
2 from boo.views.whatis import whatis
/usr/local/lib/python3.6/dist-packages/boo/boo.py in <module>()
3 from tqdm import tqdm
4
----> 5 from boo.file.download import curl
Basically, from root __init__.py the import goes to root boo.py and stumbles upon finding boo/file/download.py.
How do I make this package work on collab?
I could fix the subpackage behavior by editing setup.py as suggested here:
# ...
packages=setuptools.find_packages()
# ...
Somehow Colab is more restrictive on this parameter than local installation.

Trying to plot an image in python (using scipy and numpy)

I'm trying to run this code:
http://forumbilder.se/H8CIL/skarmavbild-2018-10-08-kl-21-22-19
so I change it to this one:
and then I got this:
http://forumbilder.se/H8CIL/skarmavbild-2018-10-08-kl-21-22-47
What's wrong? I'm a newbie, and fyi, I'm only have anaconda installed to my Python 3.6.6 .
Regards,
--
and in code:
from skimage import data
photo_data = misc.imageio('./wifire/sd-3layers.jpg')
type(photo_data)
and i get this error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-9-c8186ae7b8e9> in <module>()
1 from skimage import data
2
----> 3 photo_data = misc.imageio('./wifire/sd-3layers.jpg')
4
5 type(photo_data)
AttributeError: module 'scipy.misc' has no attribute 'imageio'
So I change it to:
You have to import imageio. You might have to install the library if you don't have it yet (on your terminal):
pip install imageio
(If you don't have pip install yet, you can do on your terminal sudo easy_install pip, see here: How do I install pip on macOS or OS X?)
And then your code to use read the image with imageio:
import imageio
im = imageio.imread('./wifire/sd-3layers.jpg')
type(im)
To display your image, you can use visvis library (https://imageio.readthedocs.io/en/stable/examples.html). Then you total code would be:
import imageio
import visvis as vv
im = imageio.imread('./wifire/sd-3layers.jpg')
vv.imshow(im)

Unable to find module qiskit_aqua.algorithms

pip-install qiskit-aqua completed successfully.
Following is ths stack trace:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-8f03022943b2> in <module>()
2 import sys
3 from datasets import *
----> 4 from qiskit_aqua.algorithms.many_sample.qsvm.data_preprocess import *
5 from qiskit_aqua.input import get_input_instance
6 from qiskit_aqua import run_algorithm
ModuleNotFoundError: No module named 'qiskit_aqua.algorithms'
After some searching, I found the code that you're running: it appears to come from one of the tutorials in the repository at https://github.com/Qiskit/aqua-tutorials. The current version of this repository is compatible with the current master branch of the Qiskit Aqua repository at https://github.com/Qiskit/aqua, which is currently somewhat ahead of the latest version available on PyPI (i.e. the one you installed using PIP). I expect PyPI will be updated with the latest version soon, but in the meantime I'd recommend that you clone the master branch of the Qiskit Aqua repository from GitHub. You can then install it using pip install -e if desired.

Cannot import caffe into python, libjpeg.so.62 not found

I cannot import caffe into (anaconda-) python.
I'm following a notebook example on "logistic regression on non-image HDF5 data". When I execute the line
import caffe
I get the following error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-17-3524921938b5> in <module>()
8 sys.path.insert(0, caffe_root + 'python')
9
---> 10 import caffe
11
/home/myName/libs/caffe/caffe-master-anaconda-python/python/caffe/__init__.py in <module>()
----> 1 from .pycaffe import Net, SGDSolver
2 from ._caffe import set_mode_cpu, set_mode_gpu, set_device, Layer, get_solver
3 from .proto.caffe_pb2 import TRAIN, TEST
4 from .classifier import Classifier
5 from .detector import Detector
/home/myName/libs/caffe/caffe-master-anaconda-python/python/caffe/pycaffe.py in <module>()
11 import numpy as np
12
---> 13 from ._caffe import Net, SGDSolver
14 import caffe.io
15
ImportError: libjpeg.so.62: cannot open shared object file: No such file or directory
The library libjpeg.so.62 is definetly installed under /usr/lib/i386-linux-gnu/libjpeg.so.62. I don't know what is going wrong here or how to tell anacondapython where to look for libjpeg.so.62.
I already tried out sudo apt-get install libjpeg62:i386 but apt-get says "libjpeg62:i386 is already the newest version. libjpeg62:i386 set to manually installed."
I compiled caffe while modifying "Makefile.config" such that it was pointing it to the ananconda python path. I also exported the PYTHONPATH and PATH of my anaconda directory:
export PATH="/home/myName/libs/anaconda/bin:$PATH"
export PYTHONPATH="/home/myName/libs/caffe/caffe-master-anaconda-python/python:$PYTHONPATH"
Ok I finally found the solution:
I had to sudo apt-get install libjpeg62
After that a new error occurred while trying to import caffe, namely
ImportError: /home/myName/libs/anaconda/bin/../lib/libm.so.6: version `GLIBC_2.15' not found (required by /usr/lib/x86_64-linux-gnu/libx264.so.142)
That could be solved by removing some buggy anaconda libraries thus resorting to the system libraries,quote shelhamer:
"Some versions of Anaconda seem to come with a bad libm. rm ~/anaconda/lib/libm.* takes care of this by reverting to the system libm."
see github bvlc

Categories

Resources