How to install python version 3.5.6 into ubuntu/ Linux? - python-3.x

I need to install python version 3.5.6. What are the requirements to install python 3.5.6.
python 3.6 is already installed on my local machine
What I have tried?
I looked into Python downloads. Downloaded tarball for python3.5.6.
Installed it by using following set of commands
wget https://www.python.org/ftp/python/3.5.6/Python-3.5.6.tar.xz
tar -xf Python-3.5.6.tar.xz
cd Python-3.5.6
sudo apt-get install libbz2-dev libsqlite3-dev build-essential
./configure
make
sudo make install
After installation when I run python3 -V it shows python 3.6.
Expected behaviour
python3 -V command should show python3.5.6
What I am doing wrong?

Try uninstalling it or removing the package all together from your computer. Afterwards try:
$ sudo apt-get install --reinstall python3.5
or you could try:
$ sudo aptitude reinstall python2.7
Best of luck.

python3.5 might show 3.5.6, depending on where and how things are on your PATH.
Either way, instead of manually compiling and installing Python (especially as you're side-stepping your package manager (apt) here which may cause trouble down the line), look into pyenv. After installation, approximately:
$ pyenv install 3.5.6
$ pyenv local 3.5.6
$ python
and you're ready to roll.

Related

Could not find a version that satisfies the requirement tensorflow==1.15.3 (from ludwig)

So i am aiming to install Ludwig for experimentation but i didn't found any solution on the internet to this issue enter image description here
screenshot of the error message
i am using windows subsytem for linux (debian)
Your python version is probably unsupported by tensorflow 1.15.3. I ran into the same issue trying to install with python 3.8.
https://github.com/tensorflow/tensorflow/issues/34302
When I compiled Ludwig from GitHub source, there were a lot of dependencies to patch. I experienced the same error message and I gave up solving it.
I retried with clean installation from the very beginning, I managed to install Ludwig successfully on Google Cloud - Debian 9 VM.
Now I redo the steps on Oracle Cloud - Ubuntu 20.04 VM.
Steps:
Ensure the following dependencies are ready, which I consolidate from various sources.
$ sudo apt update
$ sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev curl libbz2-dev lzma liblzma-dev python3-tk
Clean install Python 3.6. I choose to use older Python 3.6 to execute Ludwig, because Ludwig is using the old Tensorflow 1.15.3. I reserve Python 3.7 and 3.8 environment for other newer Python projects, for example Tensorflow 2.
# Simply use a temporary working folder.
$ cd /tmp
# Download the newest Python3.6 source.
$ curl -O https://www.python.org/ftp/python/3.6.12/Python-3.6.12.tgz
$ tar -xzvf Python-3.6.12.tgz
$ cd Python-3.6.12
# --prefix=/usr/local ensures the newly installed Python3.6 does not mess up with the default Python executables in the OS. This is specially warned in Google Cloud.
$ ./configure --prefix=/usr/local --enable-optimizations
$ sudo make altinstall
$ python3.6 --version
Python 3.6.12
# Upgrade pip and virtualenv
$ sudo python3.6 -m pip install --upgrade pip
$ sudo python3.6 -m pip install --upgrade virtualenv
Prepare the virtual environment for Ludwig.
Reference https://ludwig-ai.github.io/ludwig-docs/getting_started/#installation.
# Go back to home.
$ cd
# Create a Working directory.
$ mkdir Works
$ cd Works
# Initialize a virtual environment with Python3.6
$ virtualenv -p python3.6 ludwig
$ source ludwig/bin/activate
# Install Ludwig
$ pip install ludwig
You can see every dependencies are taken care of and Ludwig is ready to use.
$ pip list
Package Version
-------------------- -------
... ...
ludwig 0.2.2.8
...
tensorflow 1.15.3
...
# Execute Ludwig
$ ludwig

flask-mysqldb support for Python 3.6? [duplicate]

I am trying to get a Python script to run on the linux server I'm connected to via ssh. The script uses mysqldb. I have all the other components I need, but when I try to install mySQLdb via setuptools like so:,
python setup.py install
I get the following error report related to the mysql_config command.
sh: mysql_config: command not found
Traceback (most recent call last):
File "setup.py", line 15, in <module>
metadata, options = get_config()
File "/usr/lib/python2.5/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "/usr/lib/python2.5/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
Has anyone else encountered this error and if so how did you resolve it/what can I do to successfully install mysqldb?
mySQLdb is a python interface for mysql, but it is not mysql itself. And apparently mySQLdb needs the command 'mysql_config', so you need to install that first.
Can you confirm that you did or did not install mysql itself, by running "mysql" from the shell? That should give you a response other than "mysql: command not found".
Which linux distribution are you using? Mysql is pre-packaged for most linux distributions. For example, for debian / ubuntu, installing mysql is as easy as
sudo apt-get install mysql-server
mysql-config is in a different package, which can be installed from (again, assuming debian / ubuntu):
sudo apt-get install libmysqlclient-dev
if you are using mariadb, the drop in replacement for mysql, then run
sudo apt-get install libmariadbclient-dev
Reference:
https://github.com/JudgeGirl/Judge-sender/issues/4#issuecomment-186542797
I was installing python-mysql on Ubuntu 12.04 using
pip install mysql-python
First I had the same problem:
Not Found "mysql_config"
This worked for me
$ sudo apt-get install libmysqlclient-dev
Then I had this problem:
...
_mysql.c:29:20: error fatal: Python.h: No existe el archivo o el directorio
compilación terminada.
error: command 'gcc' failed with exit status 1
Then I tried with
apt-get install python-dev
(If you're using python3, install python3-dev instead.)
And then I was happy :)
pip install mysql-python
Installing collected packages: mysql-python
Running setup.py install for mysql-python
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,4,'beta',4) -D__version__=1.2.4b4 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g
In file included from _mysql.c:44:0:
/usr/include/mysql/my_config.h:422:0: aviso: se redefinió "HAVE_WCSCOLL" [activado por defecto]
/usr/include/python2.7/pyconfig.h:890:0: nota: esta es la ubicación de la definición previa
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib/x86_64-linux-gnu -lmysqlclient_r -lpthread -lz -lm -lrt -ldl -o build/lib.linux-x86_64-2.7/_mysql.so
Successfully installed mysql-python
Cleaning up...
(Specific to Mac OS X)
I have tried a lot of things, but these set of commands finally worked for me.
Install mysql
brew install mysql
brew unlink mysql
brew install mysql-connector-c
Add the mysql bin folder to PATH
export PATH=/usr/local/Cellar/mysql/8.0.11/bin:$PATH
mkdir /usr/local/Cellar/lib/
Create a symlink
sudo ln -s /usr/local/Cellar/mysql/8.0.11/lib/libmysqlclient.21.dylib /usr/local/Cellar/lib/libmysqlclient.21.dylib
brew reinstall openssl (source)
Finally, install mysql-client
LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/ pip install mysqlclient
Update:
In case this doesn't work, #vinyll suggests to run brew link mysql before step 8.
On Red Hat I had to do
sudo yum install mysql-devel gcc gcc-devel python-devel
sudo easy_install mysql-python
Then it worked.
On python 3.5.2 + any future version
sudo apt-get install libmysqlclient-dev python-dev
The below worked for me on Ubuntu 12.04 LTS:
apt-get install libmysqlclient-dev python-dev
All though it worked, i still went ahead to do the below:
export PATH=$PATH:/usr/local/mysql/bin/
I got the same error while trying to install mysql-python.
This is how I fixed it.
sudo PATH=/usr/local/mysql/bin/:$PATH pip install mysql-python
The problem was that the installer could not find the mysql_config in the default path. Now it can ..and it worked..
15 warnings generated.
clang -bundle -undefined dynamic_lookup -Wl,-F. build/temp.macosx-10.8-intel-2.7/_mysql.o -L/usr/local/mysql/lib -lmysqlclient_r -lz -lm -lmygcc -o build/lib.macosx-10.8-intel-2.7/_mysql.so -arch x86_64
Successfully installed mysql-python
Cleaning up...
Hope this helps.
Thanks.
I fixed this problem with the following steps:
sudo apt-get install libmysqlclient-dev
sudo apt-get install python-dev
sudo python setup.py install
The commands (mysql too) mPATH might be missing.
export PATH=$PATH:/usr/local/mysql/bin/
Step1:-Install Python3 & Python3-dev Both
sudo apt-get install python3 python3-dev
Step2:- Install Python & Mysql Connector
sudo apt-get install libmysqlclient-dev
step3:- Install python mysql client
sudo apt-get install mysqlclient
This will Solve your Problem
The package libmysqlclient-dev is deprecated, so use the below command to fix it.
Package libmysqlclient-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
sudo apt-get install default-libmysqlclient-dev
I think the most convenient way to solve this problem in 2020 is using another python package. We don't need install any other binary software.
Try this
pip install mysql-connector-python
and then
import mysql.connector
mydb = mysql.connector.connect(
host="",
user="",
passwd="",
database=""
)
cursor = mydb.cursor( buffered=True)
cursor.execute('show tables;')
cursor.execute('insert into test values (null, "a",10)')
mydb.commit()
mydb.disconnect()
If you're on macOS and already installed mysql#5.7 via brew install:
brew install mysql-connector-c
brew unlink mysql#5.7
brew link --overwrite --dry-run mysql#5.7 first, to see what symlinks are getting overwritten
brew link --overwrite --force mysql#5.7 to actually overwrite mysql-related symlinks with mysql#5.7
pip install mysqlclient
I fixed it by installing libmysqlclient:
sudo apt-get install libmysqlclient16-dev
In centos 7 this works for me :
yum install mariadb-devel
pip install mysqlclient
The MySQL-python package is using the mysql_config command to learn about the mysql configuration on your host. Your host does not have the mysql_config command.
The MySQL development libraries package (MySQL-devel-xxx) from dev.mysql.com provides this command and the libraries needed by the MySQL-python package. The MySQL-devel packages are found in the download - community server area. The MySQL development library package names start with MySQL-devel and vary based MySQL version and linux platform (e.g. MySQL-devel-5.5.24-1.linux2.6.x86_64.rpm.)
Note that you do not need to install mysql server.
For Alpine Linux:
$ apk add mariadb-dev mariadb-client mariadb-libs
MariaDB is a drop-in replacement for MySQL and became the new standard as of Alpine 3.2. See https://bugs.alpinelinux.org/issues/4264
On my Fedora 23 machine I had to run the following:
sudo dnf install mysql-devel
In CentOS 7 , the following things should be done:
#step1:install mysql
https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
#step2:
sudo yum install mysql-devel
or
sudo yum install mysql-community-devel
I think, following lines can be executed on terminal
sudo ln -s /usr/local/zend/mysql/bin/mysql_config /usr/sbin/
This mysql_config directory is for zend server on MacOSx. You can do it for linux like following lines
sudo ln -s /usr/local/mysql/bin/mysql_config /usr/sbin/
This is default linux mysql directory.
I had this issues and solved if by adding a symlink to mysql_config.
I had installed mysql with homebrew and saw this in the output.
Error: The `brew link` step did not complete successfully
Depending on how you got mysql it will be in different places. In my case /usr/local/Cellar/mysql
Once you know where it is you should be able to ma a symbolic link to where python is looking for it. /usr/local/mysql
This worked for me.
ln -s /usr/local/Cellar/mysql/<< VERSION >>/bin/mysql_config /usr/local/mysql/bin/mysql_config
I had the same problem. I solved it by following this tutorial to install Python with python3-dev on Ubuntu 16.04:
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install -y python3-pip
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
And now you can set up your virtual environment:
sudo apt-get install -y python3-venv
pyvenv my_env
source my_env/bin/activate
also, i fetch the same problem
I fixed this problem with the following steps:
First I run this command
sudo apt-get install libmysqlclient-dev
then I install
pip install mysqlclient==2.1.0
this is worked for me
You need to install the python-dev package:
sudo apt-get install python-dev
sudo apt-get install python-mysqldb
Python 2.5? Sounds like you are using a very old version of Ubuntu Server (Hardy 8.04?) - please confirm which Linux version the server uses.
python-mysql search on ubuntu package database
Some additional info:
From the README of mysql-python -
Red Hat Linux
.............
MySQL-python is pre-packaged in Red Hat Linux 7.x and newer. This
includes Fedora Core and Red Hat Enterprise Linux. You can also
build your own RPM packages as described above.
Debian GNU/Linux
................
Packaged as python-mysqldb_::
# apt-get install python-mysqldb
Or use Synaptic.
.. _python-mysqldb: http://packages.debian.org/python-mysqldb
Ubuntu
......
Same as with Debian.
Footnote: If you really are using a server distribution older than Ubuntu 10.04 then you are out of official support, and should upgrade sooner rather than later.
This method is only for those who know that Mysql is installed but still mysql_config can't be find. This happens if python install can't find mysql_config in your system path, which mostly happens if you have done the installation via .dmg Mac Package or installed at some custom path. The easiest and documented way by MySqlDB is to change the site.cfg. Find the mysql_config which is probably in /usr/local/mysql/bin/ and change the variable namely mysql_config just like below and run the installation again. Don't forget to un-comment it by removing "#"
Change below line
"#mysql_config = /usr/local/bin/mysql_config"
to
"mysql_config = /usr/local/mysql/bin/mysql_config"
depending upon the path in your system.
By the way I used python install after changing the site.cfg
sudo /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python setup.py install
So far, all solutions (Linux) require sudo or root rights to install .
Here is a solution if you do not have root rights and without sudo. (no sudo apt install ...):
Download the .deb file of the libmysqlclient-dev, e.g. from this mirror
Navigate to the downloaded file and run dpkg -x libmysqlclient-dev_<version tag>.deb . This will extract a folder called usr.
Symlink ./usr/bin/mysql_config to somewhere that is found on your $PATH:
ln -s `pwd` /usr/bin/mysql_config FOLDER_IN_YOUR_PATH
It should now be able to find mysql_config
Tested on Ubuntu 18.04.
For macOS Mojave , additional configuration was required, for compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
I encountered the same problem, just added the path where *mysql_config* resided to the environment variable PATH and it worked for me.
sudo apt-get build-dep python-mysqldb will install all the dependencies to build the package from PIP/easy_install

How do I get Pip to work with Python3 on Ubuntu 12.04

I'm running Ubuntu 12.04 and do not have the option of upgrading / using something else. It has Python3.2 on it. I have found out that pip doesn't come automatically with < 3.4. How can I get pip to work with Python3 on this machine?
I tried downloading a copy of get-pip.py and running it with python3.2, but I kept getting an error message about how < 3.4 support was dropped.
I spent a little bit getting this all to work so I wanted to make a detailed post.
First I found out I could get Python3.4 onto my Ubuntu 12.04 machine. To do this run:
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python3.4
Source: Is There An Easy Way To Install Python 34 On
Next, I removed Python3.2 (I only wanted to have a single Python3.x version on my machine) by running:
sudo apt-get remove python3.2
sudo apt-get remove python3.2-minimal
Then, to get pip I ran:
sudo curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
sudo python3.4 get-pip.py
Source: How To Install Pip On Ubuntu 12 04 LTS
At this point Python3.4 and pip can both be ran. Example:
python3.4 main.py
pip3 install requests
At this point I wanted to be able to just use python3 to run python3.4 - trying just python3 kept telling me I had to install python-minimal. Doing this reinstalled python3.2 for me which I did not want. Instead, I created an alias by doing the following:
vim ~/.bashrc # Open the file for editing
Add: alias python3=python3.4 to the file.
. ~/.bashrc # Make the changes apply to the current session
Source: How Do I Create A Permanent Bash Alias

ubuntu scipy works for python2.7 but not for 3.2

I have tried many ways to get scipy to play nice with python3.2 but no joy yet.
I have tried:
sudo apt-get build-dep scipy
no joy
and
sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
and still no joy
The goal is to get scipy to play nice with ipython running python3.2.
Here is the terminal output.
http://pastebin.com/LkPZUSAX
help / assistance is appreciated.
try:
sudo apt-get install python32-numpy
if you have multiple versions of python installed on your system then you have to specify the version for which you want to install the library..
also you can do
python --version
to check the default python for your system
Try running the command
sudo apt-get install python3.2-numpy
instead.
Running the command
sudo apt-get install python-numpy
installs for python2.7 be default in my case.
So one must specify the python version in apt-get command.

How to install Go

I want to install Go. I prepared system for support language. But sadly, I can't find Bison and libc6-dev following this command.
sudo apt-get install bison ed gawk gcc libc6-dev make
Then I still can't find the suitable Mercurial for Ubuntu 8.10, which is followed this command.
apt-get install python-setuptools python-dev build-essential
Therefore everyone please guide what I should do in order to install Go completely. My OS is Ubuntu version 8.10. Notice you can post the direct link for me to get packets/files.
Mercurial can typically be installed with
sudo apt-get install mercurial
The package is in universe, which you may not have enabled. The full guide, if you need it, is available here:
https://help.ubuntu.com/community/Mercurial
After installing setuptools et al., the go installation instructions say that you should install mercurial with easy-install, i.e. sudo easy_install mercurial. Are you having trouble with easy_install?
In order to install go with Homebrew run the following command on the terminal:
$ brew install golang
To check the version of go run the following command:
$ go version
To see the location run:
$ which go
To uninstall go :
$ sudo apt-get remove golang-go

Resources