Python 3.6.4 error: help('modules') and tornado pyzmq? - python

Strange error on python 3.6.4 :
C:\Python364>python.exe
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> help('modules')
Please wait a moment while I gather a list of all available modules...
C:\Python364\lib\site-packages\IPython\kernel\__init__.py:13: ShimWarning: The `
IPython.kernel` package has been deprecated since IPython 4.0.You should import
from ipykernel or jupyter_client instead.
"You should import from ipykernel or jupyter_client instead.", ShimWarning)
C:\Python364\lib\site-packages\qtawesome\iconic_font.py:268: UserWarning: You need to have a running QApplication to use QtAwesome!
warnings.warn("You need to have a running "
C:\Python364\lib\pkgutil.py:107: VisibleDeprecationWarning: zmq.eventloop.minitornado is deprecated in pyzmq 14.0 and will be removed.
Install tornado itself to use zmq with the tornado IOLoop.
yield from walk_packages(path, info.name+'.', onerror)
IPython bleach imghdr rope
The error is not show after I install nose python module and run again :
help('modules')
I don't think this error is not solved.
How to check and fix this error ?

You can ignore these warnings. Some of the packages you have installed contain deprecated modules that should not be used in new code but are still provided for backwards compatibility. help('modules') imports everything it can, so it looks like it's trying to use these deprecated modules and triggers the warning.
If you see these warnings anywhere other than help('modules'), action may be required.

Related

Python 3.6.x + Windows: Interpreter just shuts down for any external library

Due to external dependencies I need to run python 3.6.x (I know it is EOL) on Windows.
However, any external library causes the interpreter to just silently quit.
As an example I have installed numpy in the following way
py -m pip install numpy
And then running Python through PowerShell:
PS C:\Users\USER> py
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
PS C:\Users\USER>
As soon as I run import numpy the python interpreter simply silently returns.
I have tried to install every python 3.6.x available from Pythons official website, and the issue persists.
I fully removed old versions of python between each install.
I cannot find any error logs or anything.
What can be the issue here and how can I debug further?
Any internal library (that I have tried) works
I have tried with the following libraries:
Numpy
Tensorflow
Protobuf
matplotlib
scipy
pandas
nose
sympy

ModuleNotFoundError when using Visual Studio Code

I am using a machine I inherited with an Anaconda 3 installation on it. I am trying to complete a Python course, which is my first foray into Python ever. When I open a Python interpreter in Command Prompt or PowerShell, and I run the following line, it executes without error.
(base) PS D:\ProgramData\Anaconda3\Scripts> py
Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import xlsxwriter
Somehow Anaconda is integrated with VS Code, yet when I try and import xlsxwriter in this window, I get the error:
ModuleNotFoundError: No module named 'xlslwriter'
When this Python interpreter window opens, it shows the following:
Jupyter Server URI: http://localhost:8889/?token=b8a07e61e603f9dae0ee599198ac33f68d3f398036f6af0e
Python version:
3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
(6, 0, 1)
D:\\ProgramData\\Anaconda3\\envs\\py37\\python.exe
If I try installing xlsxwriter with pip, I get a message that
Requirement already satisfied: xlsxwriter in d:\programdata\anaconda3\lib\site-packages (1.2.8)
I'm not asking for an instant answer, but guidance on how I can diagnose and correct this problem. Why is the module available to some interpreters (Command Prompt and PowerShell, and Jupyter Notebook) and not available in the VS Code interpreter? How can I use VS Code and or Python functionality to learn about the config of the current environment and such things?
Based on advice given in this answer, I ran the command
!pip install xlsxwriter
in the VS Code interpreter, and finally, the module was available for import.

Why Doesn't Python 3.7 have the keyboard module like Python 3.6 did?

In python 3.6 I could say:
import keyboard
But in python 3.7, it gives me the error message saying:
no module named 'keyboard'
Is this module gone or has it been renamed?
That is not part of the standard library. You have to install it separately for each version of Python that you use.
Because you did not install this module in your Python 3.7 environment.
you can check pip list and pip install keyboard to use it.
C:\Users\TR>python
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ^Z
C:\Users\TR>pip install keyboard
Collecting keyboard
Downloading https://files.pythonhosted.org/packages/8d/14/b7a8f46e750b5905b099f0ae164a00bc99fe2a3029b4d54ae978797d2c15/keyboard-0.13.3-py2.py3-none-any.whl (58kB)
|████████████████████████████████| 61kB 178kB/s
Installing collected packages: keyboard
Successfully installed keyboard-0.13.3
It is not gone but as it is not part of built-in modules in python 3.7, you have to explicitly install it by :
pip install keyboard.

Tensorflow importing crashes Python without any error on Windows

Yesterday I was trying to solve matplotlib problems on Windows, which included solving from matplotlib import ft2font error. I have added HDF5_DISABLE_VERSION_CHECK=2 for that. But today I found, that tensorflow doesn't work anymore:
> python
Python 3.5.5 |Anaconda, Inc.| (default, Apr 7 2018, 04:52:34) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>
It thinks 30 seconds, then exits Python without any error.
Where can I see logs or crashdumps or something?
If you try import h5py, and get ImportError: DLL load failed, you probably have some problem as mine. Try:
Uninstall h5py via anaconda navigator, some relative libs (tensorflow) will be uninstalled as well.
Go VM path in anaconda installation, D:\Anaconda\envs\YOUR_VM\Lib\site-packages, delete h5py and h5py-2.8.0-py3.6.egg-info folders
Reinstall tensorflow or tensorflow-gpu

Python Error The _posixsubprocess module is not being used

Hi im running a subprocess with threads trough a python wrapper and I get the following warning when I use the subprocess module.
"The _posixsubprocess module is not being used, Child process reliability may suffer if your program uses threads."
What dose this mean?
How can I get rid of it?
check if you can import _posixsubprocess manually, subprocess tries to import this in it's code, if it produces an exception this warning is produced.
unsetting PYTHONHOME has fixed this issue for me.
I had the same issue with a tool that was installed with conda. Turned out that there was kind of a conflicting version of subprocess32 that came from pip. Running this did the trick:
pip uninstall subprocess32
conda install -c conda-forge subprocess32
The solution for me was to do the following:
pip uninstall subprocess32
pip install -U subprocess32
Intially, I was getting a warning when I tried to import matplotlib:
Python 2.7.13 (default, May 16 2017, 12:02:12)
[GCC 6.2.0 20160901] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
/home/methuselah/.local/lib/python2.7/site-packages/subprocess32.py:472: RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.
"program uses threads.", RuntimeWarning)
>>>
After reinstalling subprocess32, the warning goes away:
Python 2.7.13 (default, May 16 2017, 12:02:12)
[GCC 6.2.0 20160901] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>>
It could be if you have more than a version of Python in use.
you need to specify the correct version of python to use for each programme.
For example, I need python 3.7 for miniconda, but mendeleydesktop claims for trouble with this version:
also problem with _posixsubproces and its location
so instead of run the program in a phyton enviroment only I use python2.7, and it solve the problem.
Hope it helps.
Cheers,
Flor

Categories