Install anaconda on ARM Cortex-A9 platform - python

Base situation:
Platform: ARM Cortex-A9 (32-bit processor)
OS: Ubuntu Mate 16.04.4
gcc version: gcc (Ubuntu/Linaro 5.4.0-6ubuntu1-16.04.4) 5.4.0 201606609
python version: 2.7.12
Question:
I want to install anaconda on ARM Cortex-A9 platform. However, when I execute:
$./Anaconda2-5.0.1-Linux-x86.sh
It return an error:
/root/anaconda2/pkgs/python-2.7.14-h41cc02d_21/bin/python:1: /root/anaconda2/pkgs/python-2.7.14-h41cc02d_21/bin/python:Syntax error:word unexpected (expecting ")")
How I can fit this problem? How I can install anaconda on ARM platform?
Tks.

I think you need to run the command like this:
$ bash Anaconda2-5.0.1-Linux-x86.sh
because it's actually a bash script :)

Related

python3 configure script error - could not find pthreads

I am trying to compile python 3.7.7 on mac os Big Sur.
Downloaded the source code from python.org
running the configure script exits on error
configure: error: could not find pthreads on your system
cmake version 3.19.0
gcc version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin20.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Travis thinks the architecture is 32-bit, but Python disagrees

I'm using Travis to test Python code on various versions and architectures. I'm trying to throw a 32-bit Linux architecture into the mix.
The .travis.yml below seems to succeed in the sense that I see in the table entry for my arch: x86 job. But I also see the following output in the log, from my introspective Python code:
$ python -c 'import sys,struct,platform;print("{\n%s}"%"".join(" %25r %c %r,\n"%(c,58,eval(c)) for c in """struct.calcsize("P")*8 sys.maxsize platform.machine() platform.architecture()""".split()))'
{
'struct.calcsize("P")*8' : 64,
'sys.maxsize' : 9223372036854775807,
'platform.machine()' : 'x86_64',
'platform.architecture()' : ('64bit', 'ELF'),
}
For a 32-bit build of Python, struct.calcsize("P")*8 should return 32 and sys.maxsize should be 2147483647. The output I'm actually getting implies a 64-bit build. And since I don't believe 64-bit binaries can run on 32-bit machines, something counterintuitive seems to be going on. What am I overlooking?
# Welcome to .travis.yml
os: linux
arch: x64
language: python
install:
- python -c 'import sys,struct,platform;print("{\n%s}"%"".join(" %25r %c %r,\n"%(c,58,eval(c)) for c in """struct.calcsize("P")*8 sys.maxsize platform.machine() platform.architecture()""".split()))'
- python -m pip install --upgrade pip
- python -m pip install pytest
- python -m pip install .
script:
- python -m pytest -v .
matrix:
include:
- python: 2.7
# ...
- python: 3.8
- name: "Python 3.8 on 32-bit Linux"
arch: x86
python: 3.8

Installing hyperledger indy node code fails on python3 not being default on Mac

I am installing Hyperledger Indy (sovrin) self-identity software per these instructions.
I have Python2.7 installed via Anaconda 3. I also have Python3.6.3 installed that I downloaded and installed from here.
I'm trying to install some other software that has a dependency for Python > 3.5.
I've tried several methods to change my default Python:
Per this SO I set it manual in current terminal window:
alias python='python3'
Per same SO I vi .bash_profile and added:
alias python='python3'
then source ~/.bash_profile
Set a link to Python3:
bc-computer:~ momi$ unlink /usr/local/bin/python2
bc-computer:~ momi$ ln -s /usr/local/bin/python3 /usr/local/bin/python
but still continue to get the same error:
bc-computer:~ momi$ pip install indy-node-dev
Collecting indy-node-dev
Using cached indy-node-dev-1.2.227.tar.gz
Complete output from command python setup.py egg_info:
FAIL: Requires Python 3.5 or later, but setup.py was run using 2.7.14
NOTE: Installation failed. Run setup.py using python3
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/3f/sh6dr8wx6w720b1_w38f_fh00000gq/T/pip-build-ecZnYY/indy-node-dev/
I also tried setting up a python3 test environment per this:
python3 setup.py test
And got this error:
> /usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python:
> can't open file 'setup.py': [Errno 2] No such file or directory
Please note that I tried this suggestion which seems to be the non-duplicate answer but didn't work for me:
The safest way is to set an alias in ~/.bashrc:
alias python=python3
My environment:
uname -msra
Darwin bc-computer.local 17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64 x86_64
My OS:
High Sierra 10.13.1
which -a python
/Users/momi/anaconda2/bin/python
/usr/local/bin/python
/usr/bin/python
Thank you
Ok the solution was to use pip3 rather than pip for my install command per Mike Mueller's answer here:
pip3 install indy-node-dev
I assume that pip3 points to python3x rather than 2x.
I have also installed Hyperledger Indy SSI VC using MacOs Python 3.6.3. It is working for for me. I could demo the VON Network. It seems that your machine environment still points to Python 2.7. There are different ways by which we can point to Python 3.6.3 through virtual environment. You can try those options.

How to install gi module for anaconda python3?

python3 is my local Anaconda version of python, while python3.4 is the system one. I can import gi module with python3.4 (probably because i installed it with sudo apt-get install python3-gi) but python3 doesn't see it:
$ python3 -c 'import gi'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'gi'
$ python3.4 -c 'import gi'
$ python3 --version
Python 3.5.1 :: Anaconda 4.0.0 (64-bit)
$ python3.4 --version
Python 3.4.3
$ which python3
/home/kossak/anaconda3/bin/python3
$ which python3.4
/usr/bin/python3.4
$
How should i install gi for Anaconda python? Or maybe i can somehow import sysem-wide modules?
My os:
System: Kernel: 3.19.0-32-generic x86_64 (64 bit gcc: 4.8.2) Desktop: Cinnamon 2.8.8 (Gtk 2.24.23) dm: mdm
Distro: Linux Mint 17.3 Rosa
If you're using conda virtualenv for python-3, you can use
$ conda install -c conda-forge pygobject
in your virtualenv
You can read more about this on:
https://anaconda.org/conda-forge/pygobject
This is how you do it: (example for Linux Mint and python3)
First install gi module using your distro package manager. For Linux Mint it would be:
sudo apt-get install python3-gi
Then run your distro python to check where the module is located:
$ /usr/bin/python3
Python 3.5.2 (default, Sep 10 2016, 08:21:44)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>> print(gi)
<module 'gi' from '/usr/lib/python3/dist-packages/gi/__init__.py'>
So in my case the module gi was installed to /usr/lib/python3/dist-packages/gi. Assuming you have your anaconda installed in /home/kossak/anaconda3, create a link to gi module in the proper folder:
ln -s /usr/lib/python3/dist-packages/gi /home/kossak/anaconda3/lib/python3.5/site-packages/
If you have conda virtual environment and want gi module to be available there, the path should be a bit different. Assuming the virtual env is called TEST:
ln -s /usr/lib/python3/dist-packages/gi /home/kossak/anaconda3/envs/TEST/lib/python3.5/site-packages/
and it works:
$ python3
Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:53:06)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>>
If you want to perform a proper install (without soft linking) inside a Linux anaconda environment. Keep in mind that the errors may vary if you have not installed gcc previously (I assumed it was installed by default when I posted, however not everyone does so). Install it if you don't know very well what you're doing to avoid missunderstandings
Create or open your conda environment.
Attemp to install pygobject (don't worry, it will most likely throw an error):
pip install pygobject
In linux, it will promp the usual installation progress followed by an error:
(...) Please, try executing the following in your system:
sudo apt install libgirepository1.0-dev
Depending on your operation sistem or installed dependencies, the command name or package name may vary. Just follow the instructions and allow the system to install your packets. This step doesn't change anything, is just to give you the precise info of the package you need on your system. If you run this on Windows, it will ask you to install a specific version of Visual Studio. If you are in Windows, download the required Visual Studio from MS website, install it, reboot your computer and go to step 5 (in my case I never needed step 4 in windows, however, I'm not a MS expert.
Close your conda environment
conda deactivate
Next you need to install pygobject from conda-forge repository in your conda environment. You can add the repo to your favourite conda package manager or simply run the following command as root (it is important to be root). I did it outside the project, but you may do it inside:
conda install -c conda-forge pygobject
In my case conda was not in the path. I had is installed in:
/opt/anaconda3/bin/
You can run the following command from your normal user to find out where conda is:
which conda
Open the conda environment
source activate <your env name>
or the corresponding anaconda activate syntax (I never use it so I cant remember precisely)
Repeat the first step and now the installation wont fail:
pip install pygobject
OR if you specifically want to install gi you can run:
pip install pgi
the correct package is "pgi" NOT "gi"
As gi is a dependency of pygobject, everything will get properly installed. You can check it by running
python
>>> import gi
You may find the following usefull for Windows, although you may need to work it out a bit:
GStreammer python bindings on Windows
for me
conda install -c pkgw/label/superseded gtk3
worked

how to install Matplotlib on Cygwin?

I'm trying to install Matplotlib 1.0.1 version on latest Cygwin. In the processing, there is a weird fork error cannot be solved. I googled similar questions and found that it might be solved by manually running gcc/g++ with matplotlib 0.98.5.2 : http://innuendopoly.org/arch/matplotlib-cygwin. But it doesn't work under 1.0.1 version. Does anybody encounter the same problem?
Here are instructions for how to install matplotlib 1.1.0 on Cygwin
http://berlinbrowndev.blogspot.com/2012/01/python-matplotlib-plotting-setup-for.html
Python matplotlib plotting setup for cygwin
Matplotlib is a popular python library for generating plot graphics. It works with cygwin win32 but some non-intuitive steps are required.
Install cygwin:
CYGWIN_NT-5.1 1.7.9(0.237/5/3) 2011-03-29 10:10 i686 Cygwin
I am using cygwin with setup 2.7.3
Install python through cygwin:
This document describes installing python and matplot with cygwin. For most windows users and cygwin users, normally you would use the external python executable. I tend to prefer all of my script oriented applications running through cygwin including python.
Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)
[GCC 4.3.4 20090804 (release) 1] on cygwin
In the cygwin setup.exe installer, install:
The freetype libs, python-gtk, python-tk, libpng
gcc
Download matplotlib from sourceforge:
I am using the latest version matplotlib-1.1.0 as of 1/2012.
Download and extract the matplotlib tarball
Issues with standard python install and cygwin:
The typical 'python setup.py install' will not work with cygwin. You need to modify a configuration file and run some other additional commands.
In the root directory of the expanded matplotlib directory, copy the setup.cfg.template configuration file to setup.cfg. Edit setup.cfg.
Around line 70 in the file is a commented line, uncomment the line such that you have:
tkagg = False
Run install and watch it fail
Try running 'python setup.py install'
It should fail with an error like the following:
2 [main] python 2796 C:\cygwin\bin\python.exe: *** fatal error - unable to remap C:\cygwin\bin\cyggfortran-3.dll to same address as parent: 0x18660000 != 0x69780000
Stack trace:
Run the rebase command OUTSIDE OF THE TYPICAL CYGWIN ENV
Exit cygwin and close all cygwin instances including the one you are working with. You won't be using the typical cygwin prompt for the next command.
In windows explorer, open the cmd.exe or windows command
You will need to run rebaseall. First, shut down any long running processes like sshd, close all Cygwin prompts and so on.
Type the following commands:
cd \cygwin\bin
ash
PATH=. rebaseall -v
...
And you should get several lines of output.
Run install and watch it succeed
Try running 'python setup.py install' command again in the matplotlib directory
Running Example Program:
# python
Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)
[GCC 4.3.4 20090804 (release) 1] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
import matplotlib.pyplot as pyplot
pyplot.pie([1,2,3])
pyplot.show()
pyplot.savefig('f.png')
pyplot.savefig('x.eps')
These steps taken from www.scivision.co worked for me:
Run Cygwin setup: (For some reason the original command posted in the source link did not work for me)
install packages: (most of these you may already have)
pkg-config
ghostscript
libfreetype-devel
libpng-devel
libgtk2.0-devel
gcc-g++
git
openbox
python3-numpy
python3-pyqt5
python3-devel
Then from Cygwin Terminal:
easy_install-3.6 pip
pip install --upgrade six
pip install matplotlib
Then tested from python console:
import matplotlib
matplotlib.__version__
Installation worked for me as described by Felix above.
But to use matplotlib you need to start the Xserver from Cygwin first:
startxwin
and then start your script.

Categories

Resources