ImportError: No module named numeric - python

I get the following error
ImportError: No module named numeric if I have the following import
from numeric import *
in my python source code. How do I get this running on my Windows box against a python 2.7.x compiler?

There is a module called numeric, but it's been deprecated for years in favour of numpy. You probably want to update your code to use numpy instead.
If you really need numeric, you can get it here, but you'll have to compile it from source for Python 2.7, because the latest binaries are for 2.4.

You will probably need to install this module: http://numpy.scipy.org/
There are binaries for windows too, so installation should be easy.
Josh

There is no common module called numeric. Are you sure you don't mean import numpy?

Related

Importing winappdbg gives ModuleNotFoundError for breakpoint in PyCharm?

Whenever I try to just import winappdbg it gives me an error ModuleNotFoundError: No module named 'breakpoint'. So, I tried installing breakpoint and that gives me another error ModuleNotFoundError: No module named 'ConfigParser' and I've installed configparser several times and still get the error. (Can't find capital ConfigParser) I'm using Windows 10/PyCharm Community Edition 2017.2.3/python 3.6.3
WinAppDbg is only for Python 2.x, it does not work on Python 3.x. Honestly, I had no idea it would even let you import it.
All those import errors are happening not because of missing dependencies (also, no idea there were similarly named modules in pip), they are submodules of WinAppDbg itself. Since Python 3 has a different syntax to specify those, it tries to load them as external modules instead. I suppose you could fix that in the sources by prepending a dot before every submodule import, but I'm guessing more stuff would break down the road (string handling for example is radically different and that would affect the ctypes layer).
TL;DR: use Python 2.x.

Importing a python module in Jython StreamSets - ImportError: No module named

I'm running StreamSets in a docker on CentOS. Trying to import a python package in Jython, it returns the following error:
SCRIPTING_05 - Script error while processing record: javax.script.ScriptException: ImportError: No module named pandas in <script> at line number
Here is the code within Jython module to import my package:
import sys
sys.path.append('/path_to_my/python2.7/site-packages')
import pandas
note: Since I'm running StreamSets in a docker, I already made sure my docker has access to /path_to_my/python2.7/site-packages
Quoting u/metadaddy from ask.streamsets/168
The problem with pandas and other Python packages such as NumPy is that, even if you import the Python modules, you will not be able to use them, since they include C extensions, which cannot be loaded by Jython. There are initiatives such as JyNI that aim to bridge the gap between Jython and C extensions; SDC-7313 tracks inclusion of JyNI with the SDC Jython Evaluator.
So, I guess you will have to work around this by using a C-independent library.

Python module "preprocess" - does that exist?

In my python code I want to use a module called "topicmodels" (that can be found here https://github.com/sekhansen/text-mining-tutorial). The problem with this module is that whenever I want to "import topicmodels" in my Python code, I get the error message:
ImportError: No module name preprocess, more specifically in that topicmodels module is a Python file init.py that contains the line " from preprocess import * ". I googled and did not find a python module called preprocess - can anybody help me out on this?
(I am using Kubuntu and Python 3.5.2 | Anaconda 4.2.0).
Thanks a lot for any help!
This code is written for Python 2. You're on Python 3. The failing import is an implicit relative import, which Python 3 prohibits.
Run it on Python 2.
pip install preprocessing
Reference: https://pypi.org/project/preprocessing/

Failed to import Numeric: No module named Numeric in F2PY

When I am trying to use F2PY, I'll get the error:
Failed to import Numeric: No module named Numeric
I know that numeric is dead and instead we should use numpy. But files:
/usr/local/lib/python2.7/dist-packages/f2py2e/src/fortranobject.h and
/usr/local/lib/python2.7/dist-packages/f2py2e/f2py2e.py both use the Numeric package. I tried to replace it with numpy, but I was not successful.
I used to use f2py without any problem, but after I formatted my computer and got a fresh copy of Ubuntu, I have this problem.
I also tried to use the option --2d-numpy for f2py like:
f2py -c --fcompiler=intel --2d-numpy -m processoutput processoutput.f
But it didn't work, and it is still looking for numpy.
Thank you for your help.
I ran into a similar situation using msys under Windows, and indeed I was trying to use an outdated version of f2py. The newer version is included with numpy (and doesn't need to be installed separately). And can be found in the site-packages/numpy/f2py directory. Although my setup is a bit different, I was able to compile from python using this script:
import numpy.f2py.f2py2e as f2py2e
import sys
sys.argv += "-c -m hello hello.f".split()
f2py2e.main()
You can download old versions of Numeric here: http://sourceforge.net/projects/numpy/files/Old%20Numeric/24.2/
If you install that, I think f2py will be satisfied.

Does Pypy Support PyTables and Numpy?

And if it doesn't, is there anyway to speed up my python code for accessing pytables on a 64-bit system (so no psyco)?
There is some support numpy. Running pypy 1.9 I get the following message on importing numpy:
ImportError: The 'numpy' module of PyPy is in-development and not
complete. To try it out anyway, you can either import from 'numpypy',
or just write 'import numpypy' first in your program and then import
from 'numpy' as usual.
Nevermind...
https://bitbucket.org/pypy/compatibility/wiki/Home
The answer is no. :(

Categories