TypeError while running scons tests for Galsim installation on macOS 10.12 with anaconda - scons

I am trying to install Galsim by following the instructions on https://github.com/GalSim-developers/GalSim/blob/master/INSTALL.md#0-overall-summary but keep getting the following typeerror when I reach the scons tests portion.
Starting python tests...
scons: *** [tests/tests.log] TypeError : write() argument must be str, not bytes
Traceback (most recent call last):
File "/Users/lorena/anaconda3/lib/scons-3.0.0/SCons/Action.py", line 1197, in execute
result = self.execfunction(target=target, source=rsources, env=env)
File "/Users/lorena/git/GalSim/tests/SConscript", line 81, in run_tests
sys.stdout.write(buf)
TypeError: write() argument must be str, not bytes
scons: building terminated because of errors.
I'm using python 3.6.

Related

python 3 / flask - No module named 'MySQLdb'

I am getting an error when i try to GET some data with my flask app:
Traceback (most recent call last):
File "~/server/env/lib/python3.9/site-packages/sqlalchemy/util/_collections.py", line 1008, in __call__
return self.registry[key]
KeyError: 6166425600
this traceback ends with :
File "~/server/env/lib/python3.9/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 163, in dbapi
return __import__("MySQLdb")
ModuleNotFoundError: No module named 'MySQLdb'
When i try to pip install mysqlclient ( the recommended fix ), i get :
Collecting mysqlclient
Using cached mysqlclient-2.1.0.tar.gz (87 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/j5/b194wjbn32sbqct7crpvcp2w0000gn/T/pip-install-ijejonzz/mysqlclient_841539cf1eed4511a135f8e95cb2be75/setup.py", line 15, in <module>
metadata, options = get_config()
File "/private/var/folders/j5/b194wjbn32sbqct7crpvcp2w0000gn/T/pip-install-ijejonzz/mysqlclient_841539cf1eed4511a135f8e95cb2be75/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/private/var/folders/j5/b194wjbn32sbqct7crpvcp2w0000gn/T/pip-install-ijejonzz/mysqlclient_841539cf1eed4511a135f8e95cb2be75/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
not sure what else to do, outside of the pip install.
Do you have MySQL installed on your machine? Pip is only going to install the python connector, and it is failing because it cannot find MySQL or MariaDB installed locally.

pydev eclipse getting started - "debugger speedups using cython not found" then "another exception occurred"

I'm going through the "getting started" on the pydev website and everything had been working as described until I got to the section on debugging found at http://www.pydev.org/manual_101_run.html. However, I am now getting the warning "debugger speedups using cython not found" followed by an error when it tries to handle that exception.
The code I'm trying to run is titled example.py:
'''
Created on Nov 7, 2018
#author: Chris
'''
if __name__ == '__main__':
print('Hello World')
When I run this without debugging mode on, it correctly prints 'Hello World' to the console. As is recommended in the getting started page, I added a breakpoint to line 7 and re-ran the code in debugging mode (by pressing F11). When I do so, I get the following console output:
warning: Debugger speedups using cython not found. Run '"C:\Users\Chris\AppData\Local\Programs\Python\Python37\python.exe" "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\setup_cython.py" build_ext --inplace' to build.
pydev debugger: starting (pid: 7864)
Traceback (most recent call last):
File "_pydevd_bundle\pydevd_cython_win32_37_64.pyx", line 134, in _pydevd_bundle.pydevd_cython_win32_37_64.set_additional_thread_info
AttributeError: '_MainThread' object has no attribute 'additional_info'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\pydevd.py", line 1951, in <module>
main()
File "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\pydevd.py", line 1945, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\pydevd.py", line 1295, in run
self.notify_thread_created(thread_id, t)
File "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\pydevd.py", line 662, in notify_thread_created
additional_info = set_additional_thread_info(thread)
File "_pydevd_bundle\pydevd_cython_win32_37_64.pyx", line 138, in _pydevd_bundle.pydevd_cython_win32_37_64.set_additional_thread_info
File "_pydevd_bundle\pydevd_cython_win32_37_64.pyx", line 147, in _pydevd_bundle.pydevd_cython_win32_37_64.set_additional_thread_info
File "_pydevd_bundle\pydevd_cython_win32_37_64.pyx", line 95, in _pydevd_bundle.pydevd_cython_win32_37_64.PyDBAdditionalThreadInfo.__init__
AttributeError: '_pydevd_bundle.pydevd_cython_win32_37_64.PyDBAdditionalThreadInfo' object has no attribute 'pydev_state'
The related question Eclipse pydev warning - "Debugger speedups using cython not found." recommended running the code in the first line of the warning
"C:\Users\Chris\AppData\Local\Programs\Python\Python37\python.exe" "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\setup_cython.py" build_ext --inplace
When I do so, I get the following error
File "<input>", line 1
"C:\Users\Chris\AppData\Local\Programs\Python\Python37\python.exe" "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\setup_cython.py" build_ext --inplace
^
SyntaxError: invalid syntax
In case it is not obvious, I am an an utmost novice with python, eclipse, StackOverflow, and PyDev - having started in each of them this morning.
Regarding the issue of it not working in the first place, see: https://stackoverflow.com/a/53210935/110451 (in your case, just upgrading PyDev to 7.0.3 should fix the issue).
Now regarding not being able to regenerate the cython accelerator modules, you should execute:
"C:\Users\Chris\AppData\Local\Programs\Python\Python37\python.exe" "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\setup_cython.py" build_ext --inplace
in your terminal (i.e.: in cmd.exe) and not as a Python module...

Python 3.4 invalid syntax in setup.py on ubuntu 14.04, why?

I have a bug (ussue #14 on github) in my python project rma. Installing it trow pip 1.5.4 with python 3.4 some got error like this:
Downloading/unpacking rma
Downloading rma-0.1.5.tar.gz
Running setup.py (path:/tmp/pip_build_root/rma/setup.py) egg_info for package rma
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/rma/setup.py", line 47
setup(**sdict, install_requires=['redis', 'tabulate', 'tqdm', 'msgpack-python'])
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/rma/setup.py", line 47
setup(**sdict, install_requires=['redis', 'tabulate', 'tqdm', 'msgpack-python'])
^
SyntaxError: invalid syntax
----------------------------------------
My own pip version 8.0.2 (python is 3.5).
I newby in python, sorry if this well known issue. I want to know - should i found way to fix it (if this is my issue) or just recommend to update pip to my user?
That package won't install on any Python version < 3.5, because the syntax is indeed invalid on anything but Python 3.5 and newer.
You can't put the **kwargs syntax in front of other keyword arguments. The two should be swapped:
setup(install_requires=['redis', 'tabulate', 'tqdm', 'msgpack-python'], **sdict)
Reporting this as a bug was the correct thing to do; the package states it supports Python 3.4 and up.
Python 3.5 added support for an arbitrary number of *args and **kwargs expansions through PEP 448, opening the door for the above to work too.

New error trying to compile pygame to exe

I have created a small game for my little boy using Python 3.4 and Pygame in Windows 7. It also works in Python 2.X, with some minor bugs.
Then I tried to create an .exe file using py2exe. I prepared a setup.py file copying the source I found at pygame2exe wiki (http://www.pygame.org/wiki/Pygame2exe?parent=CookBook) also trying to use the suggestions I found in other questions here and in python-forum. What I obtained was the following error:
C:\Python34>python setup.py install
Traceback (most recent call last):
File "setup.py", line 5, in
origIsSystemDLL = py2exe.build_exe.isSystemDLL # save the orginal before we edit it
AttributeError: 'module' object has no attribute 'build_exe'
I have read all other posts on stackoverflow on pygame and exe but I haven’t found anything on this type of error on the web, is there anybody that can help me?
PS for those who prefer cx_freeze, I have tried it too, finding different problems and I will prepare soon another question on it
To give you more details, I am adding this new lines:
if I use the standard setup.py file instead, I have a dist directory with an .exe, but if I launch it I get an error window and in the log I find:
Traceback (most recent call last):
File "C:\Python34\lib\tokenize.py",
line 369, in find_cookie
line_string = line.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 2: invalid start byte
During handling of the above exception, another exception occurred: etc....
And the first lines in the cmd are about 16 missing modules
if I try to use Python 2.6 instead of 3.4 I otain a Microsoft Visual C++ runtime error with the pygame2exe version, and a similar comment in the log if I use the 'short' py2exe version (Traceback (most recent call last):
File "Nomi_Animali_1.1p.py", line 100, in
basicFont = pygame.font.SysFont("FreeSansBold.ttf", 72)
File "pygame__init__.pyc", line 70, in getattr
NotImplementedError: font module not available
(ImportError: DLL load failed: Impossibile trovare il modulo specificato.))
I have tried in all cases to use as font: None, "Arial", "FreeSansBold.ttf"
Just import py2exe.build_exe again will work
>>> import py2exe
>>> py2exe.build_exe
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'build_exe'
>>> import py2exe.build_exe
>>> py2exe.build_exe
<module 'py2exe.build_exe' from 'C:\\Python34\\lib\\site-packages\\py2exe\\build_exe.py'>

How to build package with uclibc with bitbake - Bitbake raises MultipleMatches exception while trying to build uclibc

I am trying to build uclibc for arm7a architecture, via bitbake, but I get the following output
user#ubuntu:~/stuff$ bitbake -b uclibc
ERROR: Unable to match uclibc (19 matches found):
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc-initial_git.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc_0.9.30.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc_0.9.30.2.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/bfin-uclibc_svn.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc_0.9.31.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc-initial_0.9.30.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc_0.9.29.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc-initial_0.9.30.2.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc-initial_0.9.31.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc-initial_0.9.29.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc_git.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc_0.9.28.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc_0.9.30.1.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc-initial_0.9.30.3.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc-initial_0.9.28.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc++/uclibc++_git.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/elf2flt_svn.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc-initial_0.9.30.1.bb
ERROR: /home/user/stuff/openembedded/recipes/uclibc/uclibc_0.9.30.3.bb
ERROR: Command execution failed: Traceback (most recent call last):
File "/home/user/stuff/bitbake/lib/bb/command.py", line 102, in runAsyncCommand
commandmethod(self.cmds_async, self, options)
File "/home/user/stuff/bitbake/lib/bb/command.py", line 190, in buildFile
command.cooker.buildFile(bfile, task)
File "/home/user/stuff/bitbake/lib/bb/cooker.py", line 608, in buildFile
buildfile = self.matchFile(fn)
File "/home/user/stuff/bitbake/lib/bb/cooker.py", line 591, in matchFile
raise MultipleMatches
MultipleMatches
I am trying also to build a specific recipe (Am I doing it wrong?) but I get
user#ubuntu:~/stuff$ bitbake -b /home/user/stuff/openembedded/recipes/uclibc/uclibc_0.9.31.bb
ERROR: Command execution failed: Traceback (most recent call last):
File "/home/user/stuff/bitbake/lib/bb/command.py", line 102, in runAsyncCommand
commandmethod(self.cmds_async, self, options)
File "/home/user/stuff/bitbake/lib/bb/command.py", line 190, in buildFile
command.cooker.buildFile(bfile, task)
File "/home/user/stuff/bitbake/lib/bb/cooker.py", line 618, in buildFile
self.status.add_from_recipeinfo(vfn, info)
File "/home/user/stuff/bitbake/lib/bb/cache.py", line 583, in add_from_recipeinfo
for provide in info.provides:
TypeError: 'NoneType' object is not iterable
Thanks
I answer to my own question because of the lack of informations I've found searching for this argument. I hope it is not inappropriate. So..
First of all, bitbake should be called without -b option in order to calculate package dependencies
bitbake package
Then, there's no need to build uclibc directly because bitbake builds it automatically when necessary (for that you have to use bitbake without -b option). At this point it is not finished, because for my version of Angstrom distribution (2010.x) uclibc is not default library built by bitbake but eglibc is built. So you have to add to your stuff/build/conf/local.conf this line: ANGSTROMLIBC = "uclibc", found at this faq
In the end you can find all ipk packages and sources at your stuff/tmp/deploy/uclibc.

Resources