Setuptools installation in Jython - python

Latest Jython standalone (2.7 final), latest setuptools:
C:\projects_intellij\test_jython>jython.bat ez_setup.py
C:\projects_intellij\test_jython>java -jar "C:\projects_intellij\test_jython\jython-standalone-2.7.0.jar" ez_setup.py
Extracting in C:\Users\myuser\AppData\Local\Temp\tmpt_1anc
Now working in C:\Users\myuser\AppData\Local\Temp\tmpt_1anc\setuptools-21.2.2
Installing Setuptools
Traceback (most recent call last):
File "ez_setup.py", line 425, in <module>
sys.exit(main())
File "ez_setup.py", line 422, in main
return _install(archive, _build_install_args(options))
File "ez_setup.py", line 59, in _install
if not _python_cmd('setup.py', 'install', *install_args):
File "ez_setup.py", line 51, in _python_cmd
return subprocess.call(args) == 0
File "C:\projects_intellij\test_jython\jython-standalone-2.7.0.jar\Lib\subprocess.py", line 500, in call
File "C:\projects_intellij\test_jython\jython-standalone-2.7.0.jar\Lib\subprocess.py", line 830, in __init__
File "C:\projects_intellij\test_jython\jython-standalone-2.7.0.jar\Lib\subprocess.py", line 1311, in _execute_child
TypeError: args must contain only strings
Is there a way to install this using Jython? Should I have used Jython installed by the installer instead of standalone?
Platform: Win 7 x64.

Yes, I think you should have.
It looks like a version problem.
Same here:
https://sourceforge.net/p/jython/mailman/jython-users/thread/CAOhO%3DaNmNL6xeKES2JXPkg%2BP3OTBxJCESNA0YtfLVX1L1fv85w#mail.gmail.com/

Related

Runtimeerror (python 3.5 or later is required) when I try to install any library

I am trying to install some libraries to use on my python 3.4, but every time that I run pip install ("name of library") , it returns the following error:
Collecting pyautogui
Using cached https://files.pythonhosted.org/packages/35/71/a7d328fe19667777fb0c371ca346c89d1b380f7778fa1ba65aca1090478c/PyAutoGUI-0.9.49.tar.gz
Exception:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pip\basecommand.py", line 232, in main
status = self.run(options, args)
File "C:\Python34\lib\site-packages\pip\commands\install.py", line 339, in run
requirement_set.prepare_files(finder)
File "C:\Python34\lib\site-packages\pip\req\req_set.py", line 385, in prepare_files
req_to_install.run_egg_info()
File "C:\Python34\lib\site-packages\pip\req\req_install.py", line 310, in run_egg_info
self.setup_py, self.name,
File "C:\Python34\lib\site-packages\pip\req\req_install.py", line 281, in setup_py
import setuptools # noqa
File "C:\Python34\lib\site-packages\setuptools\__init__.py", line 17, in <module>
import setuptools.version
File "C:\Python34\lib\site-packages\setuptools\version.py", line 1, in <module>
import pkg_resources
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 93, in <module>
raise RuntimeError("Python 3.5 or later is required")
RuntimeError: Python 3.5 or later is required
You are seeing this because pip 19.2 has dropped support for Python 3.4.
Good news: The get-pip.py script has been updated to include a 3.4-specific option. You can use the following command to request pip 19.1, the last version of pip that supports Python 3.4:
python get-pip.py pip==19.1
The best option here is (if you can) to upgrade to a supported python version, see https://endoflife.date/python for the list of the currently supported python versions

pip3 not installing packages

I enter the following line into terminal:
pip3 install numpy
this gives me:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 9, in <module>
load_entry_point('pip==9.0.1', 'console_scripts', 'pip3')()
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/__init__.py", line 233, in main
return command.main(cmd_args)
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/basecommand.py", line 251, in main
timeout=min(5, options.timeout)) as session:
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/basecommand.py", line 72, in _build_session
insecure_hosts=options.trusted_hosts,
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/download.py", line 329, in __init__
self.headers["User-Agent"] = user_agent()
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/download.py", line 93, in user_agent
from pip._vendor import distro
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/_vendor/distro.py", line 1050, in <module>
_distro = LinuxDistribution()
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/_vendor/distro.py", line 594, in __init__
if include_lsb else {}
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/_vendor/distro.py", line 931, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout, stderr)
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1
Im thinking its a path issue but im not really sure.
This is a bug with the distro package vendored by pip. The bug has been solved but the latest version of pip uses and very old version of distro which doesn't have this bug fix applied.
For now, you can simply try to make the executable available in the path.

Installing PIL for anaconda python2.7

I can't figure out how to install PIL on my Mac (Sierra 10.12.4) running Anaconda (conda 4.3.18) python 2.7.10. Anaconda's default python is 3.5.2, so I'm installing with pip2.
My-MacBook-ProX:dymax thisuser$ sudo pip2 install PIL
Password:
Checking the installation location...
Getting information about 'PIL'...
2.0
Traceback (most recent call last):
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/pip2/commands/install.py", line 44, in install
success = packaging.install.install(project)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/install.py", line 515, in install
info = get_infos(project)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/install.py", line 309, in get_infos
installed = list(get_distributions(use_egg_info=True))
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/database.py", line 440, in get_distributions
_generate_cache(use_egg_info, paths)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/database.py", line 103, in _generate_cache
for dist in _yield_distributions(gen_dist, gen_egg, paths):
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/database.py", line 88, in _yield_distributions
yield Distribution(dist_path)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/database.py", line 146, in __init__
self.metadata = Metadata(path=metadata_path)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/metadata.py", line 219, in __init__
self.read(path)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/metadata.py", line 323, in read
self.read_file(fp)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/metadata.py", line 330, in read_file
for field in _version2fieldlist(self['Metadata-Version']):
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/metadata.py", line 95, in _version2fieldlist
raise MetadataUnrecognizedVersionError(version)
distutils2.errors.MetadataUnrecognizedVersionError: 2.0
Traceback (most recent call last):
File "/Users/thisuser/anaconda3/bin/pip2", line 11, in <module>
load_entry_point('pip2==0.0.1.dev1', 'console_scripts', 'pip2')()
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/pip2/__init__.py", line 19, in main
args.func(args)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/pip2/cli_wrapper.py", line 24, in install
result = pip2.commands.install.install(args.project_list)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/pip2/commands/install.py", line 44, in install
success = packaging.install.install(project)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/install.py", line 515, in install
info = get_infos(project)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/install.py", line 309, in get_infos
installed = list(get_distributions(use_egg_info=True))
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/database.py", line 440, in get_distributions
_generate_cache(use_egg_info, paths)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/database.py", line 103, in _generate_cache
for dist in _yield_distributions(gen_dist, gen_egg, paths):
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/database.py", line 88, in _yield_distributions
yield Distribution(dist_path)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/database.py", line 146, in __init__
self.metadata = Metadata(path=metadata_path)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/metadata.py", line 219, in __init__
self.read(path)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/metadata.py", line 323, in read
self.read_file(fp)
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/metadata.py", line 330, in read_file
for field in _version2fieldlist(self['Metadata-Version']):
File "/Users/thisuser/anaconda3/lib/python3.5/site-packages/distutils2/metadata.py", line 95, in _version2fieldlist
raise MetadataUnrecognizedVersionError(version)
distutils2.errors.MetadataUnrecognizedVersionError: 2.0
I get identical error for sudo pip2 install pillow. I also tried with conda:
My-MacBook-ProX:dymax thisuser$ conda install pillow
Fetching package metadata ...........
Solving package specifications: .
# All requested packages already installed.
# packages in environment at /Users/thisuser/anaconda3:
#
pillow 4.1.1 py35_0
In Python3 I can import PIL. Python2.7 I still get No module named PIL. Grateful for assistance. Is my pip/pip2 configured incorrectly?
Try by giving version
pip install pillow==6.1.0(latest)
If Doesn't work try
pip list
If not listed search location of python
which python
Search for site-packages folder inside resultant location of 'python' (usually under lib/python3.5/site-packages) and check if PIL present or not(packages are not installing right location)

TyperError installing jupyter

I'm trying to install jupyter on Ubuntu 14.04 LTS but I keep getting this error. I tried giving permissions to every folder and run the code as:
sudo -H pip3 install --user jupyter
But nothing worked. I also did the update on pip and it's running the latest version.
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python3.4/dist-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File "/usr/local/lib/python3.4/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/local/lib/python3.4/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/local/lib/python3.4/dist-packages/pip/req/req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "/usr/local/lib/python3.4/dist-packages/pip/req/req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "/usr/local/lib/python3.4/dist-packages/pip/req/req_install.py", line 412, in run_egg_info
self.setup_py, self.name,
File "/usr/local/lib/python3.4/dist-packages/pip/req/req_install.py", line 387, in setup_py
import setuptools # noqa
File "/root/.local/lib/python3.4/site-packages/setuptools/__init__.py", line 12, in <module>
import setuptools.version
File "/root/.local/lib/python3.4/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/root/.local/lib/python3.4/site-packages/pkg_resources/__init__.py", line 72, in <module>
import packaging.requirements
File "/root/.local/lib/python3.4/site-packages/packaging/requirements.py", line 59, in <module>
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() missing 1 required positional argument: 'name'
Thanks for the help!
For me it works with the recent pyparsing package. Perhaps you need to upgrade your pyparsing to the recent version. If you installed it with apt-get, you need to remove the python3-pyparsing package, and install it with pip3.
sudo apt remove python3-pyparsing
sudo pip3 install pyparsing
As this answer writes, you need pyparsing>=2.0.2 to avoid this error.
I had this error as well, after a bit of digging I found this question that addresses the same error caused by some other software.
As the author states, the problem is that the call to MARKER_EXPR() should have a 'name' argument but it doesn't.
To fix this, edit line 59 of /usr/local/lib/python3.4/dist-packages/packaging/requirements.py and just add quotes to the call to MARKER_EXPR() like so:
MARKER_EXPR = originalTextFor(MARKER_EXPR(""))("marker")

buildozer fails with pure python library (pint)

I'm trying to create a kivy application, and I'd like to include the pint library so I added pint to my buildozer.spec file:
requirements = kivy, hostpython2, pint
However, when running
buildozer android_new debug deploy
I get an error (see the log below). Everything works fine if I remove pint from the requirements, but I don't understand why this would cause errors since pint is a pure python module with no dependencies.
I don't understand the errors in the log file, but I did see that ImportError: cannot import name HTTPSHandler so I tried including HTTPSHandler in the requirements as well, but that didn't fix anything.
[INFO]: # Installing pure Python modules
[INFO]: The requirements (pint) don't have recipes, attempting to install them with pip
[INFO]: If this fails, it may mean that the module has compiled components and needs a recipe.
[INFO]: -> directory context /Users/me/Personal/grocery/.buildozer/android/platform/build/build
[INFO]: -> running virtualenv --python=python2.7 venv
('name is', None, <class 'pythonforandroid.recipes.six.SixRecipe'>)
('name is', 'jnius', <class 'pythonforandroid.recipes.pyjnius.PyjniusRecipe'>)
('name is', None, <class 'pythonforandroid.recipes.kivy.KivyRecipe'>)
('path is', '/Users/me/.buildozer/android/platform/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86/bin/:/Users/me/.buildozer/android/platform/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/:/Users/me/.buildozer/android/platform/android-ndk-r9c:/Users/me/.buildozer/android/platform/android-sdk-20/tools:/Users/me/.buildozer/android/platform/apache-ant-1.9.4/bin:/Users/me/anaconda/envs/grocery/bin:/Users/me/Downloads/google-cloud-sdk/bin:/Users/me/instantclient_11_2:/Users/me/anaconda/bin:/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/Application/sDocker.app/Contents/Resources/bin')
objs_paths are ['/Users/me/Personal/grocery/.buildozer/android/platform/build/build/bootstrap_builds/sdl2-python2/collated_objects']
Copying libraries
Traceback (most recent call last):
File "/Users/me/anaconda/envs/grocery/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/Users/me/anaconda/envs/grocery/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Users/me/Personal/grocery/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 837, in <module>
main()
File "/Users/me/Personal/grocery/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 834, in main
ToolchainCL()
File "/Users/me/Personal/grocery/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 489, in __init__
getattr(self, args.subparser_name.replace('-', '_'))(args)
File "/Users/me/Personal/grocery/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 147, in wrapper_func
build_dist_from_args(ctx, dist, args)
File "/Users/me/Personal/grocery/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 190, in build_dist_from_args
build_recipes(build_order, python_modules, ctx)
File "pythonforandroid/build.py", line 582, in build_recipes
File "pythonforandroid/build.py", line 601, in run_pymodules_install
File "pythonforandroid/logger.py", line 173, in shprint
File "/Users/me/anaconda/envs/grocery/lib/python2.7/site-packages/sh.py", line 565, in next
self.wait()
File "/Users/me/anaconda/envs/grocery/lib/python2.7/site-packages/sh.py", line 500, in wait
self.handle_command_exit_code(exit_code)
File "/Users/me/anaconda/envs/grocery/lib/python2.7/site-packages/sh.py", line 516, in handle_command_exit_code
raise exc(self.ran, self.process.stdout, self.process.stderr)
sh.ErrorReturnCode_1:
RAN: '/Users/me/anaconda/bin/virtualenv --python=python2.7 venv'
STDOUT:
Running virtualenv with interpreter /Users/me/anaconda/envs/grocery/bin/python2.7
New python executable in /Users/me/Personal/grocery/.buildozer/android/platform/build/build/venv/bin/python2.7
Not overwriting existing python script /Users/me/Personal/grocery/.buildozer/android/platform/build/build/venv/bin/python (you must use /Users/me/Personal/grocery/.buildozer/android/platform/build/build/venv/bin/python2.7)
Installing setuptools, pip, wheel...
Complete output from command /Users/joshuabrownin...d/venv/bin/python2.7 - setuptools pip wheel:
Traceback (most recent call last):
File "<stdin>", line 7, in <module>
File "/Users/me/anaconda/lib/python2.7/site-packages/virtualenv-15.0.3-py2.7.egg/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/__init__.py", line 16, in <module>
File "/Users/me/anaconda/lib/python2.7/site-packages/virtualenv-15.0.3-py2.7.egg/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/vcs/subversion.py", line 9, in <module>
File "/Users/me/anaconda/lib/python2.7/site-packages/virtualenv-15.0.3-py2.7.egg/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/index.py", line 30, in <module>
File "/Users/me/anaconda/lib/python2.7/site-packages/virtualenv-15.0.3-py2.7.egg/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/wheel.py", line 39, in <module>
File "/Users/me/anaconda/lib/python2.7/site-packages/virtualenv-15.0.3-py2.7.egg/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/_vendor/distlib/scripts.py", line 14, in <module>
File "/Users/me/anaconda/lib/python2.7/site-packages/virtualenv-15.0.3-py2.7.egg/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/_vendor/distlib/compat.py", line 31, in <module>
ImportError: cannot import name HTTPSHandler
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/Users/me/anaconda/lib/python2.7/site-packages/virtualenv-15.0.3-py2.7.egg/virtualenv.py", line 2327, in <module>
main()
File "/Users/me/anaconda/lib/python2.7/site-packages/virtualenv-15.0.3-py2.7.egg/virtualenv.py", line 711, in main
symlink=options.symlink)
File "/Users/me/anaconda/lib/python2.7/site-packages/virtualenv-15.0.3-py2.7.egg/virtualenv.py", line 944, in create_environment
download=download,
File "/Users/me/anaconda/lib/python2.7/site-packages/virtualenv-15.0.3-py2.7.egg/virtualenv.py", line 900, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/Users/me/anaconda/lib/python2.7/site-packages/virtualenv-15.0.3-py2.7.egg/virtualenv.py", line 795, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/joshuabrownin...d/venv/bin/python2.7 - setuptools pip wheel failed with error code 1
STDERR:
# Command failed: python -m pythonforandroid.toolchain create --dist_name=easierGroceries --bootstrap=sdl2 --requirements=kivy,pint,hostpython2 --arch armeabi-v7a --copy-libs --local-recipes /Users/me/Personal/groecery/.buildozer/android/platform/python-for-android/recipes --color=always --storage-dir=/Users/me/Personal/grocery/.buildozer/android/platform/build
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
It seems like the error was caused by using a conda environment. When I used the default python installation (on my Mac OSX) the problem was resolved.

Categories