Python Forum
Installing from source and getting import working in linux
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Installing from source and getting import working in linux
I installed kivy and cython from source like this:

git clone
cd kivy

same for cython.
I installed packages to

There are four directories at /home/lasse/.local/lib/python2.7/site-packages/
they are kivy, cython, numpy and numpy-1.14.0.dist-info

I installed numpy with pip and I can import it anywhere.
kivy and cython imports work only in their directories, not elsewhere.

I have tried adding .bashrc this:

It does not work.

I also tried this:
import sys
It works, but it does not solve the problem.

Appreciate help
1. which GNU/Linux distro are you using.

2. always use package manager numpy. Unless you using different python version then system.

3. cython is a programming language. Normal install with package manager.
cython code is compile. Then you can import code to python.
Linux distro is Ubuntu 17.10
instead installing by source.
Kivy install docs

use package manager to install cython.
use package manager to install numpy.
sudo apt-get install cython
pip install numpy
or you could do
sudo apt-get install python-numpy
then download and setup buildozer (which is kivy's app for installing itself and dependencies and allows easy changes when creating APK files)
git clone
cd buildozer
sudo python install
Quote:apparently they now buidozer doesnt download the NDK for you, they want you to download it from
and extract it, and change the spec file to its directory path.
# Point to the directory where you extracted the crystax-ndk:
android.ndk_path = <Your install path here. Use ~ for home DIR>

go into your app directory and execute
buildozer init
buildozer android debug deploy run
the first time will take a long time as its installing SDK, NDK, etc. You can add --verbose arg to see what is going on. But every other time after that will be quick.

To test on PC, download for your architecture and OS.
and then
sudo python install
Don't use PYTHONPATH, it is not compatible with having several python interpreters. The better alternatives are using files and That said, follow above advices first.
What confuses me is this: Why does not import work?
Directories (kivy, cython and numpy) are at same directory.
|kivy |cyton |numpy

And only numpy (installed with pip) can be imported.
Dont attempt to manually move things to site-packages because you are just going to do it wrong. pip is going to install it properly, which is why numpy is the only one that works for you.

install kivy
sudo add-apt-repository ppa:kivy-team/kivy
sudo apt-get update
sudo apt-get install kivy
install cython
sudo apt-get install cython 
Have you looked at the documentation?
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
Yes I have.
I just wanted to test the latest dev versions.

Possibly Related Threads…
Thread Author Replies Views Last Post
  import pandas as pd not working in pclinuxos loren41 3 618 May-19-2019, 03:49 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020