Installing from source and getting import working in linux - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: Installing from source and getting import working in linux (/thread-7582.html) |
Installing from source and getting import working in linux - poutila - Jan-16-2018 Hello! I installed kivy and cython from source like this: git clone https://github.com/kivy/kivy.git cd kivy make same for cython. I installed packages to /home/lasse/.local/lib/python2.7/site-packages/ 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: PYTHONPATH="${PYTHONPATH}:/home/lasse/.local/lib/python2.7/site-packages/kivy:/home/lasse/.local/lib/python2.7/site-packages/cython" export PYTHONPATH It does not work. I also tried this: import sys sys.path.append('/home/lasse/.local/lib/python2.7/site-packages/cython')It works, but it does not solve the problem. Appreciate help RE: Installing from source and getting import working in linux - Windspar - Jan-16-2018 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. RE: Installing from source and getting import working in linux - poutila - Jan-16-2018 Linux distro is Ubuntu 17.10 RE: Installing from source and getting import working in linux - Windspar - Jan-16-2018 instead installing by source. Kivy install docs use package manager to install cython. use package manager to install numpy. RE: Installing from source and getting import working in linux - metulburr - Jan-16-2018 sudo apt-get install cython pip install numpyor you could do sudo apt-get install python-numpythen download and setup buildozer (which is kivy's app for installing itself and dependencies and allows easy changes when creating APK files) git clone https://github.com/kivy/buildozer cd buildozer sudo python setup.py installEDIT: Quote:apparently they now buidozer doesnt download the NDK for you, they want you to download it from go into your app directory and execute buildozer init buildozer android debug deploy runthe 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. https://kivy.org/#download and then sudo python setup.py install python [SCRIPTNAME] RE: Installing from source and getting import working in linux - Gribouillis - Jan-16-2018 Don't use PYTHONPATH, it is not compatible with having several python interpreters. The better alternatives are using files usercustomize.py and sitecustomize.py . That said, follow above advices first.
RE: Installing from source and getting import working in linux - poutila - Jan-16-2018 What confuses me is this: Why does not import work? Directories (kivy, cython and numpy) are at same directory. /home/lasse/.local/lib/python2.7/site-packages/ |kivy |cyton |numpy And only numpy (installed with pip) can be imported. RE: Installing from source and getting import working in linux - metulburr - Jan-16-2018 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 kivyinstall cython sudo apt-get install cython RE: Installing from source and getting import working in linux - wavic - Jan-16-2018 Have you looked at the documentation? RE: Installing from source and getting import working in linux - poutila - Jan-18-2018 Yes I have. I just wanted to test the latest dev versions. |