trying to import scipy.interpolate but it can’t import _fblas.pyd. It keeps throwing the following error
File "C:\cygwin64\lib\python2.7\site-packages\scipy/linalg/blas.py", line 155, in <module>
from scipy.linalg import _fblas
ImportError: cannot import name _fblas
My online research suggested that this is because I had the wrong version of numpy installed, and I need to install numpy+mkl. So I uninstalled the version I had and pip installed numpy 1.10.4, which includes mkl.
This did not fix the original problem with _flbas.pyd.
I would reinstall scipy but I can't remember where I got the version I have, and when I pip install scipy 0.17.1.tar.gz it throws an error saying that it has no blas resources, which are necessary. I've also tried to download it from here: https://github.com/scipy/scipy/releases, but they don't include _fblas.pyd in the first place.
I’m not sure where to go from here. I'm not even entirely sure why it won't import the _fblas.pyd file.
This looks like you tried to manually comply to your needed packages. Even though I take my hat off at your effort, keep in mind that this is not an simple task at all.
I might also add that this kind of work is not meant for a developer ("the person who writes the code"), but a full time maintainer. Specially with your particular Cygwin environment
So, what can you do? Alternatively, you can use one of Continuum's mkl-ready python-and-many-tools-including-mkl+scipy distribution or Enthought's Canopy. Hopefully, this will avoid you lots of hours of staring at the screen wondering what's wrong
Related
I try to inititialize HDBSCAN for clustering in JupytherLab. I use Python 3.7.6..
import numpy as np
import pandas as pd
from sklearn.datasets import load_digits
from sklearn.manifold import TSNE
import hdbscan
There always always appears the same error (see headline) and until now I do not know, from what exactly it comes from.
I have looked in several post after solutions, but no solution has helped me until yet.
For example:
uninstalled and installed numpy.
installed numpy >= 1.20.0
tried lines like pip install package --no-cache-dir --no-binary :all:
tried following package version combination: hdbscan=0.8.19, matplotlib=3.2.2, numpy=1.15.4, pandas=0.23.4, scikit-learn=0.20.1, scipy=1.1.0, tensorflow=1.13.1.
I have also tried to install packages like tensorboard, but it did not helped. Everything is installed via the Terminal and with pip.
I start to think, that the problem might be deeper - but maybe I overlooked something important.
Can somebody help me to find the bug, please?
Best regards
Philipp
I guess you've probably seen this very long HDBSCAN GitHub issue where there still doesn't seem to be a clear solution. Unfortunately it seems to affect different systems in weird ways and there is a huge list of possible solutions and things that worked for other people (personally, just reinstalling numpy worked for me when I had a similar problem last week.)
The fact that you can try so many things and still have it not work seems suspicious. Maybe something else about your Python install or the way you're trying them is affecting the solutions? For instance, is JupyterLab definitely using the same Python environment that you're trying these solutions on? (You could test this by uninstalling HDBSCAN and seeing if the error changes instead to "package not found.")
Other than the many solutions in the GitHub issue (which it sounds like you've already tried), I really don't think there's much else you can try other than freshly reinstalling Python. Something about NumPy 1.20 and a change to the C API is causing this issue and it could be that something is lurking in your install every time you try these solutions.
Alternatively, you could make a new Python install/environment with a tool like pyenv or anaconda so that it doesn't break your existing install, and you can try and install just the bare minimum on this new install (i.e. just HDBSCAN.)
Upgrading the numpy library solved the problem.
My numpy version is 1.22.0 and sklearn version is 0.24.1.
you should also look here: ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
This is a rather weird problem. I'm on Windows and using Anaconda for Python. There is a financial tool library called TA_lib (Technical Analysis Library). Since this library is not officially supported, I had to install a whl version and I got it from here.
After installation I was able to use it. But sometimes, when I start Anaconda and Spyder, the import talib command yields "Talib has no functiona as ..." and I cannot import and use it. When this happens, I follow these steps:
I close Anaconda and Spyder
I install the library again through Anaconda prompt (I see requirement already satisfied messge)
I restart Anaconda and Spyder
If I'm lucky, I can import talib after first try. If not, I have to repeat these steps for a couple of times. What might be wrong?
EDIT 1:
Now it's not working. Here is the error log:
import pandas as pd
import talib
import numpy as np
Traceback (most recent call last):
File "<ipython-input-2-a3bb601353da>", line 2, in <module>
import talib
File "C:\Users\ismetb\Desktop\AlgoritmikFinans\Classifier 11-12-2018 1830 v2\talib.py", line 90, in <module>
upperband, middleband, lowerband = talib.BBANDS(close, timeperiod=5, nbdevup=2, nbdevdn=2, matype=talib.MA_Type.T3)
AttributeError: module 'talib' has no attribute 'BBANDS'
There is a chance you've installed it wrong. Also consider that this is an unofficial library.
Make sure you installed the correct TA_lib for your Python version. What Python version are you using?
If it's 3.4, make sure you have downloaded the TA_lib cp34 for windows 64 bits or 32 bits. If it's another version, make sure you find the one appropriate to you.
Also another useful link to download TA_lib for 64bit is here.
I figured the problem. My Python file name was Talib_pure and then I renamed it to Talib. Since I import talib with import talib command, Python tried to import my own code isntead of talib library and therefore it got confused.
I renamed the file to ta_lib and now it works (so far at least).
I want to create neural network and install scipy and PyBrain for it.
On file i write:
from pybrain.tools.shortcuts import buildNetwork
net=buildNetwork(4,2,1)
and when i run that file, an error occured
from scipy.linalq import inv,det, svd, logm, expm2
ImportError: cannot import name expm2
Can you advise something?
Scipy latest version doesn't contain scipy.linalg.expm2. Instead, it has scipy.linalg._expm_frechet. So open up that .py file in Pybrain (pybrain.tools.functions) and replace the line from scipy.linalg import inv, det, svd, logm, expm2 with from scipy.linalg import inv, det, svd, logm, _expm_frechet and it should solve your problem.
This error message is basically saying:
expm2 isn't installed. i.e. Your scipy version hasn't got expm2 or something went wrong during the installation.
Try reinstalling scipy, that should do it.
The function scipy.linalg.expm2 used by PyBrain has been deprecated since v.0.13 and has been removed in v.1.0.0 (not yet released):
The deprecated functions expm2 and expm3 have been removed from
scipy.linalg.
(In section "Backwards incompatible changes")
As it seems that PyBrain has not been updated yet, you need to fall back to a Scipy version that still contains this function, such as the last release v.0.19.1.
I had the same error. I don't know if it is still relevant, but for me the error dissapeared when I changed expm2 to expm.
Just to make things easier for everyone out there trying this solution:
in the python console after installing the pybrain library, type pybrain.tools.functions as the attached figure is showing up
after the word "from" between simple quotes is your file path for the .py functions file used as show on the figure
File path shown on the python console
open it up and press CTRL + F to search for the expm2 reference in the import statement amongst the first lines of code in the file
on the import statement for expm2, replace expm2 for _expm_frechet as shown on the figure
Replacement of expm2 for _exp_frechet
now, try running your code again and jupyter lab should work with the pybrain library
To solve this problem u can do it:
Find the file "functions.py" in
"C:\Users<user-name>\AppData\Local\Programs\Python\Python310\Lib\site-packages\pybrain\tools"
Find this command "from scipy.linalg import", and then change "expm2" to "expm", do it in this function too "def sqrtm(M)":
"expm2(0.5 * logm(M)" to "expm(0.5 * logm(M)".
I keep getting this error whenever I try running this code, if I can get some insight in what is going on that would be a great help, since I'm pretty new to this coding environment I would really appreciate some help. The code is this:
File "C:\Users\user\Desktop\Python\pythonsimulation.py", line 6, in
from scipy import *
File "C:\Python34\lib\site-packages\scipy__init__.py", line 61, in
from numpy._distributor_init import NUMPY_MKL # requires numpy+mkl
ImportError: cannot import name 'NUMPY_MKL'
Am I missing some package or module that python requires in order to run the code?
Reason:
This error indicates that numpy is missing NUMPY_MKL. This usually happens when you have installed scipy from .whl (Pre-compiled File). To resolve this.
Solution:
Download numpy+MKL wheel(.whl) from following link and install using pip.
http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
If you are using Jupyter, try restarting the kernel. please click Restart in Kernel menu.
Actually, there is no problem. Just need to restart the Jupyter and you will see it is working well.
I am a programming novice, so apologize in advance if I'm asking a dumb question or perpetrating some site etiquette violation. I have tried very hard to research the answer to my question on an issue that seems to be very common, but none of the proposed solutions have worked, so am looking for some help as I just don't know what to try next.
I'm trying to import Panda from iPython onto Windows 8. I have version 2.7 of Python and have successfully downloaded Numpy. Given the suggestions on this site, I have downloaded all the file that I think Panda is dependent on (pytx, dateutil, setuptools), but it still didn't work: the error message includes:
Import Error Traceback (most recent call)
<ipython-input-2-d6ac987968b6> in <module>()
try
from.import hashtable, tslib, lib
except exception: # pragma: no cover
import datetime
- C: \Python27\lib\site-packages\pandas\__init__.py in <module>():
Import Error: No module named six
Out of desperation, I also deleted all previous version of pandas and loaded Aneconda, thinking from previous responses that might help capture all required modules including Pandas, but the same error keeps coming up.
Any help would be much appreciated, and don't worry about pointing out the obvious (since it's clearly not obvious to me.)
The easiest way to get modules up and running on Windows is to use Christoph Gohlke's Python Extension Packages for Windows repository. It includes installers for a ton of (mainly scientific-related) modules, including pandas, matplotlib, six, etc. Since many modules included compiled extensions, installing using pip doesn't always work if the package maintainer hasn't published a binary for your package of interest. Gohlke's packages include everything already pre-compiled, you just need to choose the version and bit-ness of Python, and download the .exe files.