Python3: no gzip or zlib? - module

is this module named something else now? I can't seem to find any info saying that this module was deprecated or dropped completely. (which would confuse me further)
Anyone know where this went?
Python 3.1.2 (r312:79147, May 20 2010, 09:09:30)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gzip
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.1/gzip.py", line 9, in
import zlib
ImportError: No module named zlib
UPDATE: I found this in the source bundle i used Python-3.1.2/Modules/zlib/ChangeLog
The last change was in 2005 and it doesn't mention anything telling.
ChangeLog file for zlib
Changes in 1.2.3 (18 July 2005)
- Apply security vulnerability fixes to contrib/infback9 as well
- Clean up some text files (carriage returns, trailing space)
- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant]
[SOLVED]
http://www.1stbyte.com/2005/06/26/configure-and-compile-python-with-zlib/

(Answered by editing a URL into the question. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )
The OP wrote:
[SOLVED] http://www.1stbyte.com/2005/06/26/configure-and-compile-python-with-zlib/
SO deprecates URL only answers, and it would be inappropriate to transcribe the blog from GregTheGeek on that site. However, in summary, the steps necessary are:
Install the appropriate Zlib-dev package. For example on Ubuntu it is called zlib1g-dev. This will provide the zlib.h include file.
After compiling your python sources run the configure script: ./configure –with-zlib=/usr/include
Now make and make install should work.

Related

plotnine is broken with matplotlib==3.6

I am getting the following error with plotnine==0.9 and matplotlib==3.6.
File "D:\Python\Python310\lib\site-packages\plotnine\stats\stat_density_2d.py", line 3, in <module>
import matplotlib._contour as _contour
ModuleNotFoundError: No module named 'matplotlib._contour'
If I downgrade matplotlib==3.5, the problem goes away.
It's discussed here and it's already fixed here Note that it's already merged to main.
It was due to a internal matplotlib call that is no longer supported and has been replaced.
So I guess you could choose between:
downgrade to mlp 3.5.3
install plotnine#main
till the next plotnine release.
Carlos's answer is correct. However if anybody else, like me, is uncertain of how to install plotnine#main, you can implement the fix rather easily:
Find the site_packages folder you python script uses. It usually is a subdirectory of the python version you are using, which can located reliably by trying to reinstall matplotlib or any other package you know you have access to, and checking the logs in the console. ex using python -m pip install matplotlib.
Go down into the site_packages/plotnine/stats directory and open up the stats_density_2d.py file in your editor of choice.
Apply & save the modifications made in the fix. Alternatively, overwrite the file with the one from the github.
ModuleNotFoundError: No module named 'matplotlib._contour'
Issues with matplotlib 3.6.1 and
plotnine 0.9.0
K.I.S.S.
in terminal:
pip show matplotlib #enables you to check version
pip install matplotlib==3.5 #revert and problem is resolved for now.
no more:
ModuleNotFoundError: No module named 'matplotlib._contour'
resolves issue for now that will stop progress...

Error in Power BI while importing pandas library in python scrip

Below are the mentioned error while importing pandas library in Power BI in python script.
Details: "ADO.NET: Python script error.
C:\USERS\YADAVP\ANACONDA3\lib\site-packages\numpy\__init__.py:140: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "PythonScriptWrapper.PY", line 2, in <module>
import os, pandas, matplotlib
File "C:\USERS\YADAVP\ANACONDA3\lib\site-packages\pandas\__init__.py", line 17, in <module>
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "C:\USERS\YADAVP\ANACONDA3\python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed: The specified module could not be found.
What is the resolution to sort this kind of error in Power BI?
Forget Anaconda and use WinPython.
I tried Anaconda for days with all the workarounds available in StackOverflow and other forums, and they took me nowhere.
Then I tried WinPython, and it worked immediately. Of course, you will need to change the PowerBI options accordingly.
To install WinPython: https://github.com/winpython/winpython
To change the detected Python home directory: https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts#enable-python-scripting
If you consider my answer, you won't need to downgrade Python, PBI, or anything else.
I had the same error. Unfortunately, PowerBI wont work with Jupyter Notebook Python.
So you have to install a "normal" Python: https://www.python.org/downloads/
And configure the Python you want to use in PowerBI and install your needed Python libraries via pip
Edit: Please use Python 3.8 because 3.9 doesnt support NumPy for now

Python 2.6 : Using caldav and carddav libs at the same time -> lxml ImportError

I'd like to create a VERY simple access to a Baikal CalDav/CardDav server to read address book and calenders entries. No update required, read-only!
The whole thing must run with Python 2.6 (Win32) - not 2.7 or 3.x.
I found these packages:
CalDav: https://pypi.python.org/pypi/caldav/0.4.0
CardDav: https://github.com/ljanyst/carddav-util
Well they have some dependencies which I installed and they both use lxml. So I installed this:
https://pypi.python.org/pypi/lxml/3.6.0
But now running a simple program using both libs (carddav, caldav) I encounter the following error:
File "C:\Python26\lib\site-packages\carddav.py", line 46, in <module>
import lxml.etree as ET
ImportError: DLL load failed: Die angegebene Prozedur wurde nicht gefunden.
So it seems that although the lib lxml is the latest release it does not work with carddav.py!
I tried older versions of lxml - e.g. 2.2.4 - and then it seems to work?!
What has changed and how do I work around this issue? I would really like to use lxml 3.60!
Note that Python26 and all libs are Win32.
Thank you!

How to resolve the missing python gsm module while executing airprobe

For quite some while I've been trying to work with usrp, gnuradio and airprobe. I've successfully received a data dump using usrp but when I try to use gsm_receive100.py on the captured cfile, I am always getting this error:
./gsm_receive100.py cfile
Traceback (most recent call last):
File "./gsm_receive100.py", line 12, in <module>
import gsm
ImportError: No module named gsm
I tried to look every possible place for the particular python module that is missing, both in the web and within the distribution itself but without any success so far. Has anyone faced a similar problem before, and do you know how to solve it?
Supratim -
This is either a problem with your install of the out-of-tree module, or with the module itself. To debug this, you (and anyone helping you) really needs a lot more information:
For starters:
1) What happens when you try to import the module in the Python shell?
2) What turns up when you use slocate to find the module on your computer?
3) What does $ env $PYTHONPATH tell you?
Also, this really isn't a good question for Stack Overflow. This would be better asked on the GNURadio mailing list, which is very active.
For support, you should really look to the mailing lists:
For GNU Radio: https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
For things specific to USRPs: http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
In general, the community uses the lists almost exclusively for support.

Why does qpython say "No module named sl4a"?

Install QPython from Google Play store
Open QPython, slide right and click "Console"
Try some code, starting with import androidhelper
u0_a98#android:/ $ python
Python 2.7.2 (default, Jun 3 2013, 20:01:13)
[GCC 4.4.3] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import androidhelper
Traceback (most recent call last):
File "", line 1, in
File "/storage/sdcard0/com.hipipal.qpyplus/lib/site-packages/androidhelper.py", line 43, in
import sl4a
ImportError: No module named sl4a
I'm running Cyanogenmod 10.0.0, Android 4.1.2. Any idea how to import androidhelper successfully?
QPython is still Beta so you'll need to look around for documentation.
I think you haven't added any modules to your library so you'll need to do so for your code to work.
http://qpython.org/question/62/how-to-install-3rd-part-python-modules-for-qpython/
I think the bug you describe only in console now,
But I am sure new version will fix this bug. : ) You can follow it's news on facebook http://www.facebook.com/QPython
Install the latest from the Google Play store. I'm not getting this error using QPython (classic, not QPython3).