Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toolchain.py build kivy fail #322

Closed
yanlb opened this issue Dec 13, 2018 · 15 comments
Closed

toolchain.py build kivy fail #322

yanlb opened this issue Dec 13, 2018 · 15 comments

Comments

@yanlb
Copy link

yanlb commented Dec 13, 2018

I´m follow this tutorial https://kivy.org/doc/stable/guide/packaging-ios.html and
when:

$ git clone git://github.com/kivy/kivy-ios
$ cd kivy-ios
$ ./toolchain.py build kivy

give me this error:

ERROR: pbxproj requirements is missing
To install: pip install -r requirements.txt

When run: pip install -r requirements.txt all Requirements already satisfied

and re run: ./toolchain.py build kivy and giveme the same error.

Thanks a lot

@BrianArbuckle
Copy link

I am getting the same error. I should add that when I look at the code for toolchain.py it calls for python3:

#!/usr/bin/env python3

I switched it to 2.7:

#!/usr/bin/env python2.7

And it seems to start but I get the following:

Building with 8 processes, where supported
Want to build ['kivy']
Loaded recipe kivy (depends of ['sdl2', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'ios', 'pyobjus', 'python'], optional are [])
Loaded recipe sdl2 (depends of [], optional are [])
Loaded recipe sdl2_image (depends of ['sdl2'], optional are [])
Loaded recipe sdl2_mixer (depends of ['sdl2'], optional are [])
Loaded recipe sdl2_ttf (depends of ['sdl2', 'freetype'], optional are [])
Loaded recipe ios (depends of ['python'], optional are [])
Loaded recipe pyobjus (depends of ['python'], optional are [])

ERROR: No Python version set in the build.
ERROR: Add python2 or python3 in your recipes:
ERROR: ./toolchain.py build python3 ...

I am pausing for a moment, but I think the solution may be here:

pypi buildozer

@BrianArbuckle
Copy link

FYI pypi buildozer did not help.

@ozc
Copy link

ozc commented Jan 1, 2019

I'm getting the same error. When I use the command as suggested in the error message like this /toolchain.py build python2 kivy I get this error after most of the packages are downloaded and compiled:

Download pyobjus
Downloading https://github.com/kivy/pyobjus/archive/master.zip
Traceback (most recent call last):
  File "./toolchain.py", line 1482, in <module>
    ToolchainCL()
  File "./toolchain.py", line 1218, in __init__
    getattr(self, args.command)()
  File "./toolchain.py", line 1259, in build
    build_recipes(args.recipe, ctx)
  File "./toolchain.py", line 1097, in build_recipes
    recipe.execute()
  File "/Users/ozc/Development/kivy-test/kivy-ios/toolchain.py", line 692, in execute
    self.download()
  File "/Users/ozc/Development/kivy-test/kivy-ios/toolchain.py", line 63, in _cache_execution
    f(self, *args, **kwargs)
  File "/Users/ozc/Development/kivy-test/kivy-ios/toolchain.py", line 727, in download
    self.download_file(self.url.format(version=self.version), fn)
  File "/Users/ozc/Development/kivy-test/kivy-ios/toolchain.py", line 475, in download_file
    urlretrieve(url, filename, report_hook)
  File "/Users/ozc/Development/kivy-test/venv/lib/python2.7/site-packages/future/backports/urllib/request.py", line 1759, in retrieve
    block = fp.read(bs)
  File "/Users/ozc/Development/kivy-test/venv/lib/python2.7/site-packages/future/backports/http/client.py", line 516, in read
    return bytes(super(HTTPResponse, self).read(amt))
  File "/Users/ozc/Development/kivy-test/venv/lib/python2.7/site-packages/future/backports/http/client.py", line 545, in readinto
    return self._readinto_chunked(b)
  File "/Users/ozc/Development/kivy-test/venv/lib/python2.7/site-packages/future/backports/http/client.py", line 654, in _readinto_chunked
    n = self._safe_readinto(temp_mvb)
  File "/Users/ozc/Development/kivy-test/venv/lib/python2.7/site-packages/future/backports/http/client.py", line 701, in _safe_readinto
    n = self.fp.readinto(mvb)
AttributeError: '_fileobject' object has no attribute 'readinto'
(venv) bash-3.2$ 

@yanlb
Copy link
Author

yanlb commented Jan 2, 2019

Hello:

I'm reinstall python, dependencis and then kivy and all work fine now.

Thanks a lot.
Regards

@hackalog
Copy link
Contributor

hackalog commented Jan 4, 2019

I have no idea if this is the right fix (or why it is appearing suddenly), but I can't see how the code in python-future is right here. Here's a potential workaround: PythonCharmers/python-future#423

@hackalog
Copy link
Contributor

hackalog commented Jan 9, 2019

@yanlb @ozc @tzujan : Can you try the referenced #332 to see if this fixes your issue?

Note, this workaround will require you install the requests library for python. I believe fixing the existing function requires an upstream fix in python-future (PythonCharmers/python-future#425)

@SoundsSerious
Copy link

Also getting the same error as @ozc:

AttributeError: '_fileobject' object has no attribute 'readinto'

@SoundsSerious
Copy link

So after finding that the .zip files "downloaded" were zero bytes it became evident why i would get a BadZipFile Error. Seems like the download fails.

I've just used wget to manually download the zip files that fail. so far have had to do this for kivy,pyobjus,plyer

I already had requests installed so i think that would rule that out

@hackalog
Copy link
Contributor

hackalog commented Jan 19, 2019

Having requests installed is not the fix (there's no code to use it by default). Can you try applying #332? You shoud not receive the _fileobject error with this patch. Please let me know if it makes a difference.

I had a fix for the zipfile issue in my tree. The problem is exactly that - a 0 byte zipfile is left hanging around. Let me dig it out and make a PR for it...

@ssolari
Copy link
Contributor

ssolari commented Jan 25, 2019

for anyone finding this issue an easy fix is to use miniconda or anaconda and create a conda environment. The issue is that the module inside the requirements.txt file, namely pbxproj==2.5.1 needs to be installed in the local environment.

a fix is to create a conda environment, then activate that environment and run all building within that environment

Assuming you have miniconda installed.

environment.yml file

# Use this to create the initial environment for kivy-ios
channels:
  - https://conda.anaconda.org/conda-forge
dependencies:
  - cython==0.29.1
  - python=3.7.1
  - pip:
    - kivy==1.10.1
    - pbxproj==2.5.1

then

>> conda env create -n kivyiosenv -f environment.yml
>> conda activate kivyiosenv
>> ./toolchain.py build kivy

the version for cython and python should be changed if creating a python2 environment.
Note, if you want to use ./toolchain pip install ... careful for modules like requests that are already installed in the conda environement #347.

@hackalog
Copy link
Contributor

hackalog commented Jan 25, 2019

@ssolari Thanks for that! It's not a complete workaround, however. Many of the recipe builds will fail, as they also require downloads (and will use the urlretrieve code path to do them).

That said, I do have a cookiecutter I use for starting a kivy project, whose template is a superset of what you have done above. I'll think you've encouraged me to clean it up and share it on github.

@ssolari
Copy link
Contributor

ssolari commented Feb 1, 2019

@hackalog that would be cool. Easier end to end solutions without the environment concerns I think will lead to happier users.

I also think the recipes could benefit from switching to using conda recipes instead #345

@ssolari
Copy link
Contributor

ssolari commented Feb 1, 2019

also @yanlb @tito should this issue be closed?

@yanlb yanlb closed this as completed Feb 5, 2019
@yanlb
Copy link
Author

yanlb commented Feb 5, 2019

Thanks a lot

@mc0ps
Copy link

mc0ps commented Mar 13, 2019

Same thing happened to me, fixed it by specifying python2:
./toolchain.py build python2 kivy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants