Does Pypy Support PyTables and Numpy? - python

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. :(

Related

How to get rid of 3rd collections.abc DeprecationWarning

My application is flooded with warnings from a 3rd package
transformers/modeling_deberta.py:18: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
from collections import Sequence
How can I suppress those warnings?
I've tried:
export PYTHONWARNINGS="ignore::DeprecationWarning"
warnings.filterwarnings(action="ignore")
warnings.filterwarnings(action="ignore", category=DeprecationWarning)
warnings.filterwarnings(action="ignore", category=DeprecationWarning, module=r".*transformers.*")
warnings.filterwarnings(action="ignore", category=DeprecationWarning, module=r".*collections.*")
warnings.filterwarnings(action="ignore", message=r".*collections.abc.*")
Update
The following options are not feasible:
Remove the 3rd package that generates those warnings. It is irreplaceable.
Downgrade to python 3.3
Maybe I should just wait for the 3rd package to upgrade. Just wonder if there is any other option to suppress specific 3rd party warnings in python.
The warning tells you that you are getting some resources from a location which was correct prior to Python 3.3 and will not work at all starting from Python 3.9. You are using a Python version between 3.3 and 3.9, which means that this will still work for you for the time being, but you will need to refactor your code so you import ABCs from collections.abc instead of from collections. Unless you refactor your code in the manner the error suggests, you will be stuck with Python versions prior to 3.9, which limits your possibilities, will disallow the usage of any goodies implemented after those versions and will increasingly see libraries incompatible with your project due to they being too modern for your project.
You can get rid of the warnings by downgrading your project to a Python version prior to 3.3, but that's a direction you should strive to avoid if possible. The best solution is to refactor your project to comply to the terms of modern Python versions and if you use packages that prevent you from doing so, then you might want to upgrade those packages. If there is no upgrade that would solve this issue, then it is well worth asking your question whether it is a higher cost to implement their functionality in a more modern way in terms of labor on your part or is it a higher cost in terms of technological shortage if you get stuck with old Python versions.
I found my answer from here
Solution: make sure the following code runs before the 3rd package import.
If multiprocessing is used, the code has to be called in each process.
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
from collections import Sequence

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.

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.

sys.path.append doesn't work with Python 3.x

I have Blender 2.66a which is an application that offers Python 3.3 APIs, On my system I have an installation of Python 3.2 with several modules that I wish to use inside Blender, I tried both
sys.path.append(r"/usr/lib/python3.2/")
sys.path.append("/usr/lib/python3.2/")
and this commands gives no errors, infact even the autocomplete feature works and new modules are indexed, so i tried
import tkinter
but this generates the following error
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
File "/usr/lib/python3.2/tkinter/__init__.py", line 42, in <module>
raise ImportError(str(msg) + ', please install the python-tk package')
ImportError: No module named '_tkinter', please install the python-tk package
and I don't get the point of this error because it fails to load a module that it's there asking me to install the same module because that module is not installed ( ? ).
What can cause this obscure problem ?
EDIT
the tkinter module works from the gnome-terminal
If I got you right, you're using Python 3.3 from Blender but try to include the 3.2 standard library. This is bound to give you a flurry of issues, you should not do that. Find another way. It's likely that Blender offers a way to use the 3.3 standard library (and that's 99% compatible with 3.2). Pure-Python third party library can, of course, be included by fiddling with sys.path.
The specific issue you're seeing now is likely caused by the version difference. As people have pointed out in the comments, Python 3.3 doesn't find the _tkinter extension module. Although it is present (as it works from Python 3.2), it is most likely in a .so file with an ABI tag that is incompatible with Blender's Python 3.3, hence it won't even look at it (much like a module.txt is not considered for import module). This is a good thing. Extension modules are highly version-specific, slight ABI mismatches (such as between 3.2 and 3.3, or two 3.3 compiled with different options) can cause pretty much any kind of error, from crashes to memory leaks to silent data corruption or even something completely different.
You can verify whether this is the case via import _tkinter; print(_tkinter.__file__) in the 3.2 shell. Alternatively, _tkinter may live in a different directory entirely. Adding that directory won't actually fix the real issue outlined above.

ImportError: No module named numeric

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?

Categories