Why can't I upgrade Cython (in venv)

144 views
Skip to first unread message

Henrik R.

unread,
Sep 25, 2023, 11:07:39 AM9/25/23
to Kivy users support
Hi! 

In order to test something with Kivy version 2.1.0 I tried choosing a specific Cython version in the following way, but it seems I can't install and upgrade to a specific version of Cython in a venv, although I just did that in another project... What am I doing wrong here:

(testvenv) h@hk:/mnt/4AF15A0435E762B4/mypython/touchtracer-NEW$ pip3 install --upgrade Cython==0.29.28 virtualenv
Collecting Cython==0.29.28
  Using cached Cython-0.29.28-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (1.9 MB)
Collecting virtualenv
  Using cached virtualenv-20.24.5-py3-none-any.whl (3.7 MB)
Collecting platformdirs<4,>=3.9.1
  Using cached platformdirs-3.10.0-py3-none-any.whl (17 kB)
Collecting distlib<1,>=0.3.7
  Using cached distlib-0.3.7-py2.py3-none-any.whl (468 kB)
Collecting filelock<4,>=3.12.2
  Downloading filelock-3.12.4-py3-none-any.whl (11 kB)
Installing collected packages: Cython, platformdirs, distlib, filelock, virtualenv
Successfully installed Cython-0.29.28 distlib-0.3.7 filelock-3.12.4 platformdirs-3.10.0 virtualenv-20.24.5
(testvenv) h@hk:/mnt/4AF15A0435E762B4/mypython/touchtracer-NEW$ cython -V
Cython version 0.29.19
(testvenv) h@hk:/mnt/4AF15A0435E762B4/mypython/touchtracer-NEW$ which cython
/mnt/4AF15A0435E762B4/mypython/touchtracer-NEW/testvenv/bin/cython

Juan Sanchez

unread,
Sep 25, 2023, 11:37:01 AM9/25/23
to kivy-...@googlegroups.com
Hello,

Maybe they forgot to update the version number on the executable when
they compiled it. Maybe you have a "user" install and a "venv"
install together and you need to delete any existing cython package in
~/.local.

Maybe delete the cython executable and force a reinstall. If you are
working on an NT file share, I would recommend switching to a linux
path, as it will be a lot faster.

Regards,

Juan
> --
> You received this message because you are subscribed to the Google Groups "Kivy users support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5a5d173d-ee13-419a-9a29-e8759252257bn%40googlegroups.com.
Message has been deleted

Henrik R.

unread,
Sep 26, 2023, 11:18:37 AM9/26/23
to Kivy users support
Why has my message here been deleted?

Henrik R.

unread,
Sep 26, 2023, 5:32:29 PM9/26/23
to Kivy users support
OK... Here comes a new version of the message that someone deleted:

Dear Juan

1. Which of the following files and directories under ~/.local should I delete:

file:///home/henrik/.local/bin/cythonize
file:///home/henrik/.local/bin/cython
file:///home/henrik/.local/lib/python3.8/site-packages/cython.py
file:///home/henrik/.local/lib/python3.8/site-packages/Cython
file:///home/henrik/.local/lib/python3.8/site-packages/Cython-0.29.19.dist-info
file:///home/henrik/.local/lib/python3.8/site-packages/__pycache__/cython.cpython-38.pyc
file:///home/henrik/.local/lib/python3.8/site-packages/Cython/Debugger/libcython.py
file:///home/henrik/.local/lib/python3.8/site-packages/Cython/Debugger/Tests/TestLibCython.py
file:///home/henrik/.local/lib/python3.8/site-packages/Cython/Debugger/Tests/test_libcython_in_gdb.py
file:///home/henrik/.local/lib/python3.8/site-packages/Cython/Debugger/Tests/__pycache__/test_libcython_in_gdb.cpython-38.pyc
file:///home/henrik/.local/lib/python3.8/site-packages/Cython/Debugger/Tests/__pycache__/TestLibCython.cpython-38.pyc
file:///home/henrik/.local/lib/python3.8/site-packages/Cython/Debugger/__pycache__/libcython.cpython-38.pyc
file:///home/henrik/.local/lib/python3.8/site-packages/Cython/Compiler/CythonScope.py
file:///home/henrik/.local/lib/python3.8/site-packages/Cython/Compiler/__pycache__/CythonScope.cpython-38.pyc
file:///home/henrik/.local/lib/python3.8/site-packages/Cython/Utility/CythonFunction.c
file:///home/henrik/.local/lib/python3.8/site-packages/Cython/Utility/TestCythonScope.pyx
file:///home/henrik/.local/lib/python3.8/site-packages/Cython/Build/Cythonize.py
file:///home/henrik/.local/lib/python3.8/site-packages/Cython/Build/__pycache__/Cythonize.cpython-38.pyc
file:///home/henrik/.local/lib/python3.8/site-packages/Cython/Tests/TestCythonUtils.py
file:///home/henrik/.local/lib/python3.8/site-packages/Cython/Tests/__pycache__/TestCythonUtils.cpython-38.pyc

2. Are you saying that on Ubuntu a Linux Ext4 partition is much faster than a (Microsoft) NTFS partition?

Juan Sanchez

unread,
Sep 27, 2023, 10:56:22 AM9/27/23
to kivy-...@googlegroups.com
Hi Henrik,

>
> 1. Which of the following files and directories under ~/.local should I delete:
>

The first thing I would try would be to start a new terminal, without
the venv loaded, and the do a:

pip uninstall Cython

or

pip --user uninstall Cython

If that doesn't work, you can try to remove all of those cython files
you have found.

If that doesn't work, you can even remove the ~/.local directory and
reinstall buildozer.

To the best of my knowledge buildozer is the only package that doesn't
work within a virtual environment.

Then only install the rest of the packages in a virtual environment.

>
> 2. Are you saying that on Ubuntu a Linux Ext4 partition is much faster than a (Microsoft) NTFS partition?
>

The linux partition supports all of the needed file attributes and
timestamps that may not be well supported on a NT partition. Also
there is a level of indirection in the WSL 2 when interacting with the
host NT system that makes it much slower when I have tried to compile
anything.

See this excellent explanation.

https://stackoverflow.com/a/68974497/104910

Regards,

Juan
> To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/b39f96e4-6fef-4aef-b42a-ee9e808a7474n%40googlegroups.com.

Henrik R.

unread,
Sep 27, 2023, 3:37:09 PM9/27/23
to Kivy users support
1. Yes - closing and re-opening Terminal and do "$ pip uninstall Cython" seems to be enough, to remove Cython so I could create and activate a new venv and install the version of Cython I needed in order to run my test-app with Kivy 2.1.0. 
Thank you!

2. I will consider converting my NTFS partition to Linux Ext4 so that it runs faster under Ubuntu 20.04.

Henrik R.

unread,
Oct 1, 2023, 7:58:30 AM10/1/23
to Kivy users support
1. I also compiled my TouchTracer test app for Android with Kivy 2.2.1. It doesn't work. I have reported the bug here: https://github.com/kivy/kivy/issues/8384 - "on_touch_down() in FloatLayout() does not work in Kivy 2.2.1 (see also issue #7861)"

2. I managed to convert my NTFS partition to Ext4 and mount it in the same directory, so all paths still work. So now my TouchTracer test app gets compiled on an Ext4 partition instead of an NTFS partition. The compile process creates 3.7 GB data and is now about 20% faster. :-)

elli...@cox.net

unread,
Oct 1, 2023, 10:29:07 AM10/1/23
to kivy-...@googlegroups.com

Looking on GitHub the code for FloatLayout has not changed in 3 years, same for Layout (the parent class of FloatLayout).  Perhaps there is an issue in a module they are importing – but I suggest you work to narrow down the issue.  Start with one of your examples and remove code until you are left with a small example that demonstrates the problem.

 

It strikes me as odd that the problem only manifests on Android.  Give it is a touch issue – I wonder if this an issue related to:

  • screen size
  • code that is only in an Android code path
  • code specifically compiled for Android
  • version or compatibility issue in the build environment for Android (Buildozer…)

 

Your assumption of an issue with FloatLayout seems quite unlikely.

 

If you set the screen size to match your Android device, do you see the issue on a desktop platform?

Henrik R.

unread,
Oct 1, 2023, 11:40:29 AM10/1/23
to Kivy users support
As I explain on the Github issue post, this problem is specific for Android and it started with Kivy 2.1.0. And I think we should discuss it there, and not here. :-)

Henrik R.

unread,
Oct 4, 2023, 4:44:07 PM10/4/23
to Kivy users support
OK! The mentioned bug has been solved - see https://github.com/kivy/kivy/issues/8384 .
Reply all
Reply to author
Forward
0 new messages