Cannot import scitools using Anaconda-Python - python

I am trying to install scitools with the hope of being able to use Easyviz. I installed scitools for windows as suggested in the first link. However, when I type from scitools.std import * into python I get the following error message:
ImportError: No module named oldnumeric.mlab
numpy import failed!
see doc of scitools.numpytools module for how to choose Numeric instead
This was discussed here and categorized as fixed, however I don't see how I can make this work or how to fix it. Is there something I am supposed to do to make this work?

I encountered the same issue on Ubuntu 16.04 LTS. However, such issue was not found on Trisquel GNU Linux.
The solution which I found by randomly testing was -
Do not import scitools. Just import numpy.
As an example if you were to write -
from scitools.std import *
simply do -
import numpy as np
and use numpy libraries. For plotting use matplotlib that will solve this issue.

Related

Python4Delphi can't import numpy

I was curious about Python4Delphi and installed it and looked through the demos a bit. Now I wanted to install Numpy via CMD with pip this went well without errors. but now when I enter the following code in DEMO01 of Python4Delphi I get an error message. If I enter the same code in python it works. How can i solve this?
How i installed Numpy:
pip install numpy
Example code:
import numpy as np
print(np .__version__)
The error i got:
AttributeError: partially initialized module 'numpy' has no attribute '__version__' (most likely due to a circular import). Did you mean: '_version'?
The versions:
Delphi 11,
Python 3.10.4,
Pip 22.1,
Numpy 1.22.4 and
Win64
if i forgot some information let met know.
Can you check you're using the same versions of python using both methods by checking what this returns...
import sys
for p in sys.path:
print(p)
Carefully compare the output of that little bit of code as it'll point out any obvious differences.
From my experiments if you've got more than one Python on your system things can get weird with Python4Delphi so the above should provide evidence if this is your situation.
Importing numpy should actually cause an exception anyway, just not the one you mention in your question. Importing Numpy in demo01 will trigger a div by zero unless you add a MaskFPUExceptions(True); before you execute the python
If you use an embedded Python things will get even worse for you as you'll need to set some additional paths to import anything. The only way I've found to do this properly ATM is by addending paths to sys.path in a small python stub with paths constructed relative to the embedded root (Lib and Lib/site-packages incidentally)

ImportError: cannot import name 'array2d'

Code:
from sklearn.utils.validation import array2d
Output:
ImportError: cannot import name 'array2d'
I have installed sklearn v0.23.1 with pycharm.
I tried to look in site-packages\sklearn\utils\validation.py and find "array2d" with ctrl+F, but it is not there. Can I import something when it is not in the file?
I am not sure, if the problem is in installation or import.
According to the documentation of the latest stable version (currently 0.23.1), there is no module array2d in sklearn.utils.validation.
The situation is the same for the previous versions 0.22.2, 0.21.3, 0.20.4, 0.19.2, and 0.18.2.
Not sure where you got this from and what you are trying to do - googling the error leads to this closed Github thread, where the usage is not like the one you try here (and the error there comes from a broken installation, which is certainly not the case here).
In short, the command from sklearn.utils.validation import array2d is invalid, and the error thus justified.

ImportError: No module named 'Tkinter''

Looking at this link, when I install Python it says Tcl/Tk/Tkinter will also install, but when I run a game in Python, I get an import error. I have my usual import statements as well, but it's still not working. I also looked at this very similar problem, but the answer isn't working for me.
import simplegui
import random
from tkinter import *
Assuming you are using Python 3.x, programs must be run with python3 my-program.py (not python my-program.py).
I am assuming you are using python2.
Try this
from Tkinter import *
You are putting wrong name for module. This will work.
EDIT AFTER COMMENT
For python3 install this python3-tk and your code will work.

Import error when using scipy.io module

I'm involved in a raspberry pi project and I use python language. I installed scipy, numpy, matplotlib and other libraries correctly. But when I type
from scipy.io import wavfile
it gives error as "ImportError: No module named scipy.io"
I tried to re-install them, but when i type the sudo cord, it says already the new version of scipy is installed. I'm stucked in this point and please help me... Thank you
I would take a guess and say your Python doesnt know where you isntalled scipy.io. add the scipy path to PYTHONPATH.

python: ImportError: No module named patheffects

When i try to run a python script in which i do an import statement matplotlib.patheffects, i get an error message saying there is no module called patheffects.
the statement is
import matplotlib.patheffects
Kindly help me to figure out the reason for this error and how to make the code run without this glitch.
import matplotlib.patheffects works perfectly well for me. Please make sure you have matplotlib installed. The most current version is 1.0.1. You can download from here.
Matplotlib depends on numpy, so make sure you have it installed before installing matplotlib.
Also check out the tips on installing matplotlib.

Categories

Resources