I am trying to use py2app on the following code:
print(1+1)
I create my setup with:
py2applet --make-setup test.py
Development with alias mode works fine:
python3 setup.py py2app -A
But when I try the standalone mode:
python3 setup.py py2app
I get after a lot of lines:
WARNING: Mach-O header in '/Users/quentinpeter/Documents/PHD/Python/People project/Michele_worms/dist/test.app/Contents/Resources/lib/python3.6/scipy/linalg/_interpolative.cpython-36m-darwin.so' may be too large to relocate
WARNING: Mach-O header in '/Users/quentinpeter/Documents/PHD/Python/People project/Michele_worms/dist/test.app/Contents/Resources/lib/python3.6/scipy/linalg/_interpolative.cpython-36m-darwin.so' may be too large to relocate
Traceback (most recent call last):
File "setup.py", line 18, in <module>
setup_requires=['py2app'],
File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.6/site-packages/py2app/build_app.py", line 764, in run
self._run()
File "/usr/local/lib/python3.6/site-packages/py2app/build_app.py", line 974, in _run
self.run_normal()
File "/usr/local/lib/python3.6/site-packages/py2app/build_app.py", line 1082, in run_normal
self.create_binaries(py_files, pkgdirs, extensions, loader_files)
File "/usr/local/lib/python3.6/site-packages/py2app/build_app.py", line 1385, in create_binaries
platfiles = mm.run()
File "/usr/local/lib/python3.6/site-packages/macholib/MachOStandalone.py", line 146, in run
node.write(f)
File "/usr/local/lib/python3.6/site-packages/macholib/MachO.py", line 133, in write
header.write(f)
File "/usr/local/lib/python3.6/site-packages/macholib/MachO.py", line 343, in write
self.synchronize_size()
File "/usr/local/lib/python3.6/site-packages/macholib/MachO.py", line 333, in synchronize_size
self.parent.filename, self.total_size + self.sizediff, self.low_offset, self.sizediff))
ValueError: New Mach-O header is too large to relocate in '/Users/quentinpeter/Documents/PHD/Python/People project/Michele_worms/dist/test.app/Contents/Resources/lib/python3.6/scipy/linalg/_interpolative.cpython-36m-darwin.so' (new size=1764, max size=1712, delta=108)
Do you have any idea what might happen? Most of the things I found online refers to MacPorts but I use homebrew.
info on my python:
Python 3.6.0 (default, Dec 24 2016, 08:01:42)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
I had the same problem and I fixed it by uninstalling the version of macholib that I had (1.8) and installing 1.7 with pip. When using python 2.7, reverting to scipy version 0.14.0 would fix it as well.
Related
I am using pyinstaller on CentOS 7 to convert a .py file to an executable. I am on python3.7.6
I have done:
$python3.7 -m pip install pyinstaller
$pyinstaller test.py --onefile
This gives me:
8942 INFO: Python library not in binary dependencies. Doing additional searching...
Traceback (most recent call last):
File "/usr/local/bin/pyinstaller", line 8, in <module>
sys.exit(run())
File "/usr/local/lib/python3.7/site-packages/PyInstaller/__main__.py", line 126, in run
run_build(pyi_config, spec_file, **vars(args))
File "/usr/local/lib/python3.7/site-packages/PyInstaller/__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 815, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 762, in build
exec(code, spec_namespace)
File "/root/test.spec", line 19, in <module>
noarchive=False)
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 294, in __init__
self.__postinit__()
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/datastruct.py", line 159, in __postinit__
self.assemble()
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 540, in assemble
self._check_python_library(self.binaries)
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 645, in _check_python_library
python_lib = bindepend.get_python_library_path()
File "/usr/local/lib/python3.7/site-packages/PyInstaller/depend/bindepend.py", line 967, in get_python_library_path
raise IOError(msg)
OSError: Python library not found: libpython3.7.so, libpython3.7.so.1.0, libpython3.7mu.so.1.0, libpython3.7m.so, libpython3.7m.so.1.0
This would mean your Python installation doesn't come with proper library files.
This usually happens by missing development package, or unsuitable build parameters of Python installation.
* On Debian/Ubuntu, you would need to install Python development packages
* apt-get install python3-dev
* apt-get install python-dev
* If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)
As pointed out here I have tried:
$env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.7.6
I have also installed python-devel:
$yum install python36-gobject-devel.x86_64
$yum install python3-devel.x86_64
$yum install python34-devel.x86_64
I am not sure what am I missing here. Any help will be appreciated.
I want to install Python 3.7 on a web hosting server that is live (production) without disturbing anything. I have SSH terminal access and I guess the server is running centos from the following commands:
> cat /proc/version
Linux version 3.10.0-693.11.6.1.ELK.el6.x86_64 (...) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC) )
> rpm -qa centos-release
centos-release-6-10.el6.centos.12.3.x86_64
I tried to see what was installed with:
> rpm -qa | sort
...
Python27-2.7.8-1.x86_64
Python27-MySQL-1.2.3-2.el6.x86_64
Python27-bs4-4.1.3-1.noarch
Python27-distribute-0.6.32-1.noarch
Python27-lxml-3.0.1-1.x86_64
Python27-pip-1.2.1-1.noarch
Python27-regex-0.1.20120904-1.x86_64
Python27-virtualenv-1.8.4-1.noarch
Python3-3.2.3-1.x86_64
Python3-distribute-0.6.32-1.noarch
Python3-pip-1.2.1-1.noarch
Python3-virtualenv-1.8.4-1.noarch
...
So it looks like there's Python 2.7 and 3.2 already installed, and I don't want to disturb them.
I want to run a Python 3.7 script with dependencies on some modules.
What is the safest way of installing Python 3.7 (along with pip for modules) somewhere that will not mess with the current installation?
NOTE: I am familiar with conda/pip mostly on Windows, but I have limited knowledge of this linux environment.
EDIT: I first thought it was RHEL. I edited the post for centos.
EDIT: I have tried many unsuccessful attempts to install Python 3.7 on this shared web hosting:
Trying to create a virtualenv with Python 3.2:
> python3 -m virtualenv my_isolated_py3
New python executable in my_isolated_py3/bin/python3
Also creating executable in my_isolated_py3/bin/python
Installing distribute.....................
Complete output from command /home2/cccccc/my_isolated_py3/bin/python3 -c "#!python
\"\"\"Bootstra... sys.exit(main())
":
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.31.tar.gz
Traceback (most recent call last):
File "<string>", line 541, in <module>
File "<string>", line 537, in main
File "<string>", line 201, in download_setuptools
File "/opt/python3/lib/python3.2/urllib/request.py", line 138, in urlopen
return opener.open(url, data, timeout)
File "/opt/python3/lib/python3.2/urllib/request.py", line 375, in open
response = meth(req, response)
File "/opt/python3/lib/python3.2/urllib/request.py", line 487, in http_response
'http', request, response, code, msg, hdrs)
File "/opt/python3/lib/python3.2/urllib/request.py", line 413, in error
return self._call_chain(*args)
File "/opt/python3/lib/python3.2/urllib/request.py", line 347, in _call_chain
result = func(*args)
File "/opt/python3/lib/python3.2/urllib/request.py", line 495, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: SSL is required
----------------------------------------
...Installing distribute...done.
Traceback (most recent call last):
File "/opt/python3/lib/python3.2/runpy.py", line 160, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/opt/python3/lib/python3.2/runpy.py", line 73, in _run_code
exec(code, run_globals)
File "/opt/python3/lib/python3.2/site-packages/virtualenv.py", line 2560, in <module>
main()
File "/opt/python3/lib/python3.2/site-packages/virtualenv.py", line 964, in main
never_download=options.never_download)
File "/opt/python3/lib/python3.2/site-packages/virtualenv.py", line 1071, in create_environment
search_dirs=search_dirs, never_download=never_download)
File "/opt/python3/lib/python3.2/site-packages/virtualenv.py", line 616, in install_distribute
search_dirs=search_dirs, never_download=never_download)
File "/opt/python3/lib/python3.2/site-packages/virtualenv.py", line 583, in _install_req
cwd=cwd)
File "/opt/python3/lib/python3.2/site-packages/virtualenv.py", line 1042, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home2/cccccc/my_isolated_py3/bin/python3 -c "#!python
\"\"\"Bootstra... sys.exit(main())
" failed with error code 1
The key error is urllib.error.HTTPError: HTTP Error 403: SSL is required, which seems related to old non-https repository.
Trying to create a virtualenv with Python 2.6:
> python -m virtualenv my_isolated_py2
Traceback (most recent call last):
File "/usr/lib64/python2.6/runpy.py", line 122, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.6/runpy.py", line 34, in _run_code
exec code in run_globals
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 2352, in <module>
main()
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 825, in main
symlink=options.symlink)
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 985, in create_environment
site_packages=site_packages, clear=clear, symlink=symlink))
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 1179, in install_python
copyfile(join(stdlib_dir, fn), join(lib_dir, fn), symlink)
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 479, in copyfile
copyfileordir(src, dest, symlink)
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 454, in copyfileordir
shutil.copytree(src, dest, symlink)
File "/usr/lib64/python2.6/shutil.py", line 173, in copytree
raise Error, errors
shutil.Error: [('/usr/lib64/python2.6/config/libpython2.6.so', 'my_isolated_py2/lib/python2.6/config/libpython2.6.so', '[Errno 2] No such file or directory')]
Trying to install Python 3.7 miniconda:
> wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
Resolving repo.anaconda.com... 104.16.130.3, 104.16.131.3, 2606:4700::6810:8203, ...
Connecting to repo.anaconda.com|104.16.130.3|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 85055499 (81M) [application/x-sh]
Saving to: `Miniconda3-latest-Linux-x86_64.sh'
100%[=========================================>] 85,055,499 108M/s in 0.8s
2020-06-11 08:22:53 (108 MB/s) - `Miniconda3-latest-Linux-x86_64.sh' saved [85055499/85055499]
> bash Miniconda3-latest-Linux-x86_64.sh
...
Unpacking payload ...
Miniconda3-latest-Linux-x86_64.sh: line 409: /home2/cccccc/miniconda3/preconda.tar.bz2: No such file or directory
Trying to install Python 3.7 from sources:
> wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
> tar xvzf Python-3.7.3.tgz
> cd Python-3.7.3
> ./configure --prefix=$HOME/python_37
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.7... no
checking for python3... python3
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in '/home2/cccccc/Python-3.7.3':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
Trying to install Python 3.7 portable binaries:
> wget https://github.com/indygreg/python-build-standalone/releases/download/20200408/cpython-3.7.7-linux64-20200409T0045.tar.zst
> [unzstd on another machine since not installed here]
> tar -xvf cpython-3.7.7-linux64-20200409T0045.tar
...
tar: python/install/share/man/man1/python3.1: Cannot create symlink to `python3.7.1': No such file or directory
...
> ./python/install/bin/python3.7m
./python/install/bin/python3.7m: /lib64/libc.so.6: version `GLIBC_2.13' not found (required by ./python/install/bin/python3.7m)
I also found out that this shared web hosting greatly limits what we can do through terminal, which is jailshell.
Do I have any options left to use Python 3.7 on this machine?
You can use venv to completely isolate your python environment from all other python versions (and python libraries) installed in the system.
Read the virtual environment, venv, docs here.
Last version of anaconda, windows 10, python 3.6.
Installing tensorflow seems to break pip.
>conda create -n py6 python=3.6
>activate py6
>conda install tensorflow
>pip install tweepy
Collecting tweepy
Exception:
Traceback (most recent call last):
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\req\req_set.py", line 554, in _prepare_file
require_hashes
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\req\req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\index.py", line 568, in _get_pages
page = self._get_page(location)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\index.py", line 811, in get_page
inst = cls(resp.content, resp.url, resp.headers)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\index.py", line 731, in __init__
namespaceHTMLElements=False,
TypeError: parse() got an unexpected keyword argument 'transport_encoding'
Use of tweepy is just an example, pip cannot install any package.
The same happens when installing tensorflow using pip, and when using a python 3.5 virtual environment.
Probably this is due to some package update gone wrong, and it will be fixed in the next update.
Meanwhile, any fix or any careful selection of working version numbers is welcome.
This issues is reported in the following ticket : https://github.com/tensorflow/tensorboard/issues/588
To solve this, you need to repair html5lib.
Or alternatively,
you can make use of anaconda to re-install
conda install -c anaconda html5lib
I am using python 3.4 and i have installed kivy and buildozer succesfully but when i run the command "buildozer android debug". I am getting the following output. Please help to debug the issue.
# Install platform
# Apache ANT found at /home/paul/.buildozer/android/platform/apache-ant-1.8.4
# Android SDK is missing, downloading
Traceback (most recent call last):
File "/usr/local/bin/buildozer", line 9, in <module>
load_entry_point('buildozer==0.15', 'console_scripts', 'buildozer')()
File "/usr/local/lib/python3.4/dist-packages/buildozer/scripts/client.py", line 13, in main
Buildozer().run_command(sys.argv[1:])
File "/usr/local/lib/python3.4/dist-packages/buildozer/__init__.py", line 957, in run_command
self.target.run_commands(args)
File "/usr/local/lib/python3.4/dist-packages/buildozer/target.py", line 85, in run_commands
func(args)
File "/usr/local/lib/python3.4/dist-packages/buildozer/target.py", line 95, in cmd_debug
self.buildozer.prepare_for_build()
File "/usr/local/lib/python3.4/dist-packages/buildozer/__init__.py", line 157, in prepare_for_build
self.target.install_platform()
File "/usr/local/lib/python3.4/dist-packages/buildozer/targets/android.py", line 365, in install_platform
self._install_android_sdk()
File "/usr/local/lib/python3.4/dist-packages/buildozer/targets/android.py", line 235, in _install_android_sdk
raise SystemError('Unsupported platform: {0}'.format(platform))
SystemError: Unsupported platform: linux
Your version of bulldozer ist too old. There is this commit fixing the exact issue you have:
- elif platform in ('linux2', 'linux3'):
+ elif platform.startswith('linux'):
Upgrading to a more recent version will solve your problem.
I installed zeromq on ubuntu 10.04 and the compilation went through without any errors.
However when i try to run the python test, it results in this error:
jerome#VM1:~/zeromq/pyzmq-2.0.7$ python setup.py test
running test
Traceback (most recent call last):
File "setup.py", line 144, in <module>
'Topic :: System :: Networking'
File "/usr/lib/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "setup.py", line 59, in run
tests = TestLoader().loadTestsFromNames(testfiles)
File "/usr/lib/python2.6/unittest.py", line 613, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/usr/lib/python2.6/unittest.py", line 576, in loadTestsFromName
module = __import__('.'.join(parts_copy))
File "/home/jerome/zeromq/pyzmq-2.0.7/zmq/__init__.py", line 26, in <module>
from zmq import _zmq
ImportError: /home/jerome/zeromq/pyzmq-2.0.7/zmq/_zmq.so: invalid ELF header
What do i need to do to fix this?
Try setting up pyzmq like this:
python setup.py configure --zmq=<your_zmqlibrary_installation_path>
python setup.py build_ext --rpath=<your_zmqlibrary_installation_path>/lib --inplace
python setup.py install
python setup.py test
According to how can i fix this invalid ELF header errror? you need to compile zeromq on your target instead of using a MAC OS X version ...