python3 in virtualenv yolk call causes IOError - linux

In ubuntu lucid I have python 2.6.5 by default.I compiled python3.3.1 and set up virtualenv and wrapper such that workon envpy331 gets me to work on python3.3.1.Then I installed yolk using pip
Now,when I run
>>yolk -l
it lists all python libraries installed even in python2.6.5 as below ,and finally throws an IOError
BeautifulSoup - 3.0.7a - active development (/usr/local/lib/python2.6/dist-packages)
Brlapi - 0.5.4 - active development (/usr/lib/pymodules/python2.6)
CouchDB - 0.6 - active development (/usr/lib/pymodules/python2.6)
Django - 1.3.1 - active development (/usr/local/lib/python2.6/dist-packages)
Fabric - 1.5.1 - active development (/usr/local/lib/python2.6/dist-packages/Fabric-1.5.1-py2.6.egg)
...
nose - 1.3.0 - active development (/usr/local/lib/python2.6/dist-packages)
numpy - 1.3.0 - active
nvidia-common - 0.0.0 - active
oauth - 1.0a - active
odict - 1.3.2 - active development (/usr/local/lib/python2.6/dist-packages/odict-1.3.2-py2.6.egg)
Traceback (most recent call last):
File "/usr/local/bin/yolk", line 9, in <module>
load_entry_point('yolk==0.4.3', 'console_scripts', 'yolk')()
File "/usr/local/lib/python2.6/dist-packages/yolk/cli.py", line 1090, in main
my_yolk.run()
File "/usr/local/lib/python2.6/dist-packages/yolk/cli.py", line 203, in run
return getattr(self, action)()
File "/usr/local/lib/python2.6/dist-packages/yolk/cli.py", line 223, in show_all
return self.show_distributions("all")
File "/usr/local/lib/python2.6/dist-packages/yolk/cli.py", line 298, in show_distributions
metadata = get_metadata(dist)
File "/usr/local/lib/python2.6/dist-packages/yolk/metadata.py", line 38, in get_metadata
msg = email.message_from_string(dist.get_metadata('PKG-INFO'))
File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 1488, in get_metadata
f = open(self.path,'rU')
IOError: [Errno 2] No such file or directory: '/usr/lib/python2.6/dist-packages/onboard-0.0.0.egg-info'
Any idea why this happens? Do I need to compile python3 again and set up virtualenv?

Found the answer in a pull request on github
This will let people and tools (e.g.: https://python3wos.appspot.com/) know that yolk is compatible with Python 3.
Should do a release to PyPI; it seems that the latest code in GitHub works with Python 3, but the last released version on PyPI (0.4.3; released 2012-02-06) doesn't work with Python 3.
so use the github release instead

Related

Robotframework RIDE tool showing error "Things are going to break, please only change locale by creating wxLocale objects to avoid this!"

Below modules are installed on Window 10 PC
C:\Users\Pandit>pip list
Package Version
------------------- -----------
numpy 1.22.3
Pillow 9.0.1
pip 19.2.3
Pygments 2.11.2
Pypubsub 4.0.3
pywin32 303
robotframework 4.1.3
robotframework-ride 1.7.4.2
setuptools 41.2.0
six 1.16.0
wxPython 4.0.7.post2
While launching ride.py below error is observed :
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 70.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 71.
<class 'robotide.preferences.configobj.UnreprError'> Parse error in value at line 13.
Traceback (most recent call last):
File "c:\program files\python38\lib\site-packages\robotide\application\application.py", line 58, in OnInit
self.frame = RideFrame(self, self._controller)
File "c:\program files\python38\lib\site-packages\robotide\ui\mainframe.py", line 175, in __init__
self._init_ui()
File "c:\program files\python38\lib\site-packages\robotide\ui\mainframe.py", line 279, in _init_ui
self.tree = Tree(self, self.actions,
File "c:\program files\python38\lib\site-packages\robotide\ui\tree.py", line 86, in __init__
self._images = TreeImageList()
File "c:\program files\python38\lib\site-packages\robotide\ui\images.py", line 42, in __init__
TestCaseController: _TreeImage(self, 'robot.png'),
File "c:\program files\python38\lib\site-packages\robotide\ui\images.py", line 80, in __init__
self.normal = self._get_image(image_list, normal)
File "c:\program files\python38\lib\site-packages\robotide\ui\images.py", line 91, in _get_image
img = wx.Image(path, wx.BITMAP_TYPE_PNG).ConvertToBitmap()
wx._core.wxAssertionError: C++ assertion "strcmp(setlocale(LC_ALL, NULL), "C") == 0" failed at ..\..\src\common\intl.cpp(1579) in wxLocale::GetInfo(): You probably called setlocale() directly instead of using wxLocale and now there is a mismatch between C/C++ and Windows locale.
**Things are going to break, please only change locale by creating wxLocale objects to avoid this!
OnInit returned false, exiting...
Error in atexit._run_exitfuncs:
wx._core.wxAssertionError: C++ assertion "GetEventHandler() == this" failed at ..\..\src\common\wincmn.cpp(478) in wxWindowBase::~wxWindowBase(): any pushed event handlers must have been removed**
Looks like RIDE tool is not supporting robotframework in python 3.8.0
Please help here if any solution available.
Thanks in Advance.
Like mentioned on the RIDE project README:
The pre-release and current development, supports Python 3.8 (since February 2020).
So you can try to install the Beta1:
Install current Beta version (2.0b1) with:
pip install psutil
pip install -U --pre robotframework-ride

Unable to install pandas=0.18.1 on Python3.6

I am trying to setup a legacy project using python 3.6.13 as a constraint. Though I am running into an issue trying to install pandas version 0.18.1
The log are as below:
Collecting numpy==1.11.1 (from -r requirements-remote.txt (line 25))
Using cached https://files.pythonhosted.org/packages/e0/4c/515d7c4ac424ff38cc919f7099bf293dd064ba9a600e1e3835b3edefdb18/numpy-1.11.1.tar.gz
Collecting pandas==0.18.1 (from -r requirements-remote.txt (line 26))
Using cached https://files.pythonhosted.org/packages/11/09/e66eb844daba8680ddff26335d5b4fead77f60f957678243549a8dd4830d/pandas-0.18.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "/Users/qqqqq/.pyenv/versions/3.6.13/envs/pyenv36/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/Users/qqqqq/.pyenv/versions/3.6.13/envs/pyenv36/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/Users/qqqqq/.pyenv/versions/3.6.13/envs/pyenv36/lib/python3.6/site-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/Users/qqqqq/.pyenv/versions/3.6.13/envs/pyenv36/lib/python3.6/site-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/var/folders/zc/tjmjl2890y57f30n1yg7dg39xl_6k6/T/easy_install-zcqg452m/numpy-1.21.0rc2/setup.py", line 34, in <module>
_CYTHON_INSTALLED = ver >= LooseVersion(min_cython_ver)
RuntimeError: Python version >= 3.7 required.
The error is pretty explicit: Python version >= 3.7 required. According to the paths you’re using 3.6 (i.e. from 2016, and that will reach end-of-life at the end of the year).
This seems to come from the fact that pandas is trying to install numpy-1.21.0rc2 as a dependency, see the traceback (emphasis mine):
File "/var/folders/zc/tjmjl2890y57f30n1yg7dg39xl_6k6/T/easy_install-zcqg452m/numpy-1.21.0rc2/setup.py", line 34, in
I’m not sure why pandas is doing that, but if you first install the numpy from your requirements file, pandas might consider that dependency resolved.
pip install numpy==1.11.1
pip install -r requirements-remote.txt
By the way, neither numpy 1.11.1 nor pandas 0.18.1 list python 3.6 as a supported python version, they both have 3.5 at most. It might still work, but maybe it could also fail due to python 3.6 being too new (I have no way of testing this − sorry). You could try to refresh these dependencies to the highest versions that still support python 3.6:
numpy 1.19.5
pandas 1.1.5

Incompatible versions of aws-sam-cli and jmespath while deploying serverless app

While I try to deploy a serverless application on AWS Lambda, I incur in the following error:
STDERR: ERROR: aws-sam-cli 0.46.2 has requirement jmespath~=0.9.5, but you'll have jmespath 0.9.4 which is incompatible.
ERROR: Exception:
Traceback (most recent call last):
File "/var/lang/lib/python3.6/shutil.py", line 550, in move
os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: '/tmp/pip-target-ykxrpsrj/lib/python/gast-0.3.3.dist-info' -> '/var/task/gast-0.3.3.dist-info'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/var/lang/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
status = self.run(options, args)
File "/var/lang/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 454, in run
options.target_dir, target_temp_dir, options.upgrade
File "/var/lang/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 512, in _handle_target_dir
target_item_dir
File "/var/lang/lib/python3.6/shutil.py", line 561, in move
symlinks=True)
File "/var/lang/lib/python3.6/shutil.py", line 321, in copytree
os.makedirs(dst)
File "/var/lang/lib/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/var/task/gast-0.3.3.dist-info'
WARNING: You are using pip version 20.0.2; however, version 20.2.3 is available.
You should consider upgrading via the '/var/lang/bin/python3.6 -m pip install --upgrade pip' command.
I am using a new Anaconda environment created from scratch and my requirement file, within my application, states:
jmespath==0.9.5
Before deploying I use the following command to install plugins (e.g. tensorflow):
serverless plugin install -n serverless-python-requirements
Docker is correctly running and my serverless.yml file contains the following:
plugins:
- serverless-python-requirements
custom:
pythonRequirements:
dockerizePip: true
zip: true
slim: true
noDeploy:
- boto3
- botocore
- docutils
- jmespath
- pip
- python-dateutil
- s3transfer
- setuptools
- six
- tensorboard
How can I solve this issue?
As noted in another SO question, it may be due to an experimental Docker feature called Use gRPC FUSE for file sharing, which I switched off for now. Deploys seem to be ok thereafter.

Building PySide 1.2.0: no pyside-uic

I compiled PySide 1.2.0 for python 3.3 on my machine (Ubuntu 13.04 x64), but, for some reason, pyside-tools don't get "compiled".
When I try to execute pyside-uic (after install) I get this error:
Traceback (most recent call last):
File "/usr/local/bin/pyside-uic", line 9, in <module>
load_entry_point('PySide==1.2.0', 'console_scripts', 'pyside-uic')()
File "/usr/local/lib/python3.3/dist-packages/distribute-0.6.49-py3.3.egg/pkg_resources.py", line 345, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python3.3/dist-packages/distribute-0.6.49-py3.3.egg/pkg_resources.py", line 2382, in load_entry_point
return ep.load()
File "/usr/local/lib/python3.3/dist-packages/distribute-0.6.49-py3.3.egg/pkg_resources.py", line 2088, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/local/lib/python3.3/dist-packages/PySide-1.2.0-py3.3.egg/PySide/scripts/uic.py", line 28, in <module>
from pysideuic.driver import Driver
ImportError: No module named 'pysideuic'
The egg file doesn't have the pysideuic folder. And when I check the pyside_install/py3.3-qt4.8.4-64bit-release/lib folder, I found that a "python2.7" folder exist!!
I build the sources using the instructions from this page: https://pypi.python.org/pypi/PySide.
Please, help.
It should be fixed now. Please get latest version of pyside-setup from github [1] and rebuild pyside distribution. Let me know if you have any issues.
[1] https://github.com/PySide/pyside-setup
Try to find the pyside-uic.exe or uic.exe in python folder/scripts and copy it in the required directory. or if not found any script in the particular directory, then reinstall PySide and check for any logs that say where pyside UIC is installed. Because I have also used python 2.x and I have personally experienced this problem. Check out for the scripts subfolder in python installation directory

Spyder IDE fails to start on Windows 10 with Python 3.8 [duplicate]

This question already has answers here:
Jupyter Notebook with Python 3.8 - NotImplementedError
(4 answers)
Closed 3 years ago.
Note: this issue is fixed in Spyder 4.1.3!
(original question) checking out Python 3.8 (x64) on Windows 10, I got into trouble when trying to setup Spyder. Note: the issue was reproducible with a fresh Python installation on a clean Windows-10 system. However, no such issues on Linux (tested on debian / Mint19.x).
At first, everything went smooth during installation via pip install spyder.
error #1: pywin32
After starting Spyder, it said in the IPython console window:
Traceback (most recent call last):
File "c:\users\USERNAME\appdata\local\programs\python\python38\lib\site‑packages\spyder\plugins\ipythonconsole.py", line 1572, in create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle)
File "c:\users\USERNAME\appdata\local\programs\python\python38\lib\site‑packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "c:\users\USERNAME\appdata\local\programs\python\python38\lib\site‑packages\jupyter_client\connect.py", line 470, in write_connection_file
self.connection_file, cfg = write_connection_file(self.connection_file,
File "c:\users\USERNAME\appdata\local\programs\python\python38\lib\site‑packages\jupyter_client\connect.py", line 141, in write_connection_file
with secure_write(fname) as f:
File "c:\users\USERNAME\appdata\local\programs\python\python38\lib\contextlib.py", line 113, in __enter__
return next(self.gen)
File "c:\users\USERNAME\appdata\local\programs\python\python38\lib\site‑packages\jupyter_core\paths.py", line 424, in secure_write
win32_restrict_file_to_user(fname)
File "c:\users\USERNAME\appdata\local\programs\python\python38\lib\site‑packages\jupyter_core\paths.py", line 359, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed while importing win32api: Das angegebene Modul wurde nicht gefunden.
I was able to fix the import error by running pywin32_postinstall.py -install from the scripts folder (from a cmd prompt with elevated rights). That copies pythoncom38.dll and pywintypes38.dll from \Lib\site-packages\pywin32_system32 to \windows\system32, see also here - however, I'd suggest to not modify system folders and use the option I put in my answer below.
error #2: tornado
However, now Spyder just freezes at the loading screen (logo displayed, saying something like "initializing main window")!
cloning the dev version of Spyder from https://github.com/spyder-ide/spyder.git and running it via python bootstrap.py --debug reveals the cause of the freeze:
2019-11-03 17:39:53,261 [ERROR] [tornado.application] -> Exception in callback functools.partial(<function ThreadedZMQSocketChannel.__init__.<locals>.setup_stream at 0x0000015E00B758B0>)
Traceback (most recent call last):
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python38\lib\site-packages\tornado\ioloop.py", line 743, in _run_callback
ret = callback()
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python38\lib\site-packages\jupyter_client\threaded.py", line 48, in setup_stream
self.stream = zmqstream.ZMQStream(self.socket, self.ioloop)
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 127, in __init__
self._init_io_state()
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 546, in _init_io_state
self.io_loop.add_handler(self.socket, self._handle_events, self.io_loop.READ)
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python38\lib\site-packages\tornado\platform\asyncio.py", line 99, in add_handler
self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python38\lib\asyncio\events.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError
...so it seems the import error caused by the Python 3.8 version of pywin32 is only one issue. There's also a problem related to tornado IO (web server), see here / here.
last checked with Python 3.8.2 (AMD64), Spyder 4.1.1. Please note that I am not using Anaconda. Use either conda or pip, not both.
Spyder 4.1.3 Update: The issue is fixed!
(Tested on Python 3.8.3rc1, tornado 6.0.4)
If you come here still experiencing similar startup issues with Spyder: the first thing to try I'd suggest upgrade to Spyder version >= 4.1.3.
older version of this answer
workaround, tornado issue:
Modify the file ...\Python38...\Lib\site-packages\tornado\platform\asyncio.py;
add
import sys
if sys.platform == 'win32':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
after the other import statements. Source: here on SO and also linked here. If I get this post on the tornado repo right, this is likely to be a pretty permanent workaround.
if also needed - workaround, pywin32 issue:
Modify the file ...\Python38\Lib\site-packages\jupyter_core\path.py;
add a line
import pywintypes
before import win32api in line 359. This modification is based on this post.

Resources