Error message installing virtual environment Python 3.5 Linux Mint 17 - python-3.x

Linux Mint 17 with Python 3.5.1
$ python3 -m venv ENV_DIR
returns:
Error: Command '['/home/path/to/ENV_DIR/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1
I have tried various ways to get the terminal to show I am in a venv with no success.

That's due to a bug in Ubuntu 14.04 (on which Linux Mint 17 is based)
You can either create the virtual environment without pip and then manually install it inside the environment:
$ python3 -m venv --without-pip my_venv
$ source my_venv/bin/activate
(my_venv)$ curl https://bootstrap.pypa.io/get-pip.py | python
Or you can manually install ensurepip in your system, by adapting these instructions to Python 3.5.1:
cd /usr/lib/python3.5
sudo mkdir -p ensurepip/_bundled
cd ensurepip
sudo wget https://github.com/akheron/cpython/raw/v3.5.1/Lib/ensurepip/__init__.py
sudo wget https://github.com/akheron/cpython/raw/v3.5.1/Lib/ensurepip/__main__.py
sudo wget https://github.com/akheron/cpython/raw/v3.5.1/Lib/ensurepip/_uninstall.py
cd _bundled
sudo wget https://github.com/akheron/cpython/raw/v3.5.1/Lib/ensurepip/_bundled/pip-1.5.4-py2.py3-none-any.whl
sudo wget https://github.com/akheron/cpython/raw/v3.5.1/Lib/ensurepip/_bundled/setuptools-

Related

psql (PostgreSQL) 9.2.24 / linux - cannot find pg_hba.conf as I need to adjust it

Version: psql (PostgreSQL) 9.2.24 - I also downloaded Version 11.8.
to download v 9 I just ran:
sudo apt-get update
sudo apt-get install python-psycopg2
sudo apt-get install postgresql postgresql-contrib
to get v 11 - I followed this github comment:
https://stackoverflow.com/questions/49573258/installing-postgresql-client-v10-on-aws-amazon-linux-ec2-ami
sudo yum install -y gcc readline-devel zlib-devel
wget https://ftp.postgresql.org/pub/source/v10.4/postgresql-10.4.tar.gz
tar -xf postgresql-10.4.tar.gz
cd postgresql-10.4
./configure
make -C src/bin
sudo make -C src/bin install
make -C src/include
sudo make -C src/include install
make -C src/interfaces
sudo make -C src/interfaces install
make -C doc
sudo make -C doc install
The new package should be installed with all its executables in here: /usr/local/pgsql/bin
Now, keep in mind that commands psql, pg_dump etc. still point to the old version of the psql client. You can run with the full executable paths (/usr/local/pgsql/bin/psql) or prepend the new directory at the beginning of your $PATH so that the system will look it up first:
Edit ~/.bash_profile adding this at the end:
export PATH="/usr/local/pgsql/bin:$PATH"
Then run:
source ~/.bash_profile
Now everything should be ready:
[ec2-user#ip-xx-x-x-xxx ~]$ psql --version
psql (PostgreSQL) 10.4
I am running on EC2 - these are details
NAME="Amazon Linux AMI"
VERSION="2018.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2018.03"
PRETTY_NAME="Amazon Linux AMI 2018.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2018.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
I am trying to try out Airflow and following these guides:
https://medium.com/#achilleus/robust-apache-airflow-deployment-dd02a6c75c78
https://medium.com/#abraham.pabbathi/airflow-on-aws-ec2-instance-with-ubuntu-aff8d3206171
Having trouble finding pg_hba.conf file
I ran
sudo su
cd /etc
ls
ls returned the below:
image below

docker ERROR: Could not find a version that satisfies the requirement apturl==0.5.2

I am using windows 10 OS. I want to build an container based on linux so I can replicate code and dependencies developed from ubuntu. When I try to build it outputs Error message as above.
From my understanding docker for desktop runs linux OS kernel under-the-hood therefore allowing window users to run linux based containers, not sure why it is outputting this error.
My dockerfile looks like this:
FROM ubuntu:18.04
ENV PATH="/root/miniconda3/bin:${PATH}"
ARG PATH="/root/miniconda3/bin:${PATH}"
RUN apt update \
&& apt install -y htop python3-dev wget
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& mkdir root/.conda \
&& sh Miniconda3-latest-Linux-x86_64.sh -b \
&& rm -f Miniconda3-latest-Linux-x86_64.sh
RUN conda create -y -n ml python=3.7
COPY . src/
RUN /bin/bash -c "cd src \
&& source activate ml \
&& pip install -r requirements.txt"
requirements.txt contains:
apturl==0.5.2
asn1crypto==0.24.0
bleach==2.1.2
Brlapi==0.6.6
certifi==2020.11.8
chardet==3.0.4
click==7.1.2
command-not-found==0.3
configparser==5.0.1
cryptography==2.1.4
cupshelpers==1.0
dataclasses==0.7
When I run docker build command it outputs:
1.649 ERROR: Could not find a version that satisfies the requirement apturl==0.5.2 1.649 ERROR: No matching distribution found for apturl==0.5.2 Deleting it and running it lead to another error. All error seem to be associated with ubuntu packages.
Am I not running a ubuntu container? why aren't I allowed to install ubuntu packages?
Thanks!
You try to install ubuntu packages with pip (which is for python packages")
try apt install -y apturl
If you want to install python packages write pip install package_name

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

error: command 'gcc' failed with exit status 1 while installing GDAL for Python3 on AWS EC2

I'm trying to install GDAL to use with Python 3 on an AWS EC2 Amazon2 machine (RHEL7).
Following the instructions on this page: Install GDAL on Python 2.7 on a Amazon Linux virtual server I managed to get it working for python 2.7 ("import gdal from osgeo" works).
However, I need it to work for python3 installed on my machine. I tried to adjust the instructions accordingly, and got to this set of commands:
sudo yum-config-manager --enable epel
sudo yum -y install make automake gcc gcc-c++ libcurl-devel proj-devel geos-devel gdal-devel gdal-python python3-devel
sudo yum -y update
cd /tmp
curl -L http://download.osgeo.org/gdal/2.4.0/gdal-2.4.0.tar.gz | tar zxf -
cd gdal-2.4.0/
./configure --prefix=/usr/local --with-python
sudo make -j4
sudo make install
python3 -m pip install numpy --user
sudo -H pip3 install --upgrade pip
CPLUS_INCLUDE_PATH=/usr/include/gdal
C_INCLUDE_PATH=/usr/include/gdal
sudo python3 -m easy_install GDAL -d /usr/lib/python3.7/site-packages --include-dirs=/usr/include/gdal
when I run the last command, the installation tries to run but fails with:
"error: command 'gcc' failed with exit status 1".
There are many errors before that, such as:
/usr/local/include/cpl_vsi_error.h:58:24: error: ‘CPL_FORMAT_STRING’ has not been declared
CPL_FORMAT_STRING(const char *fmt), ... )
^~~~~~~~~~~~~~~~~
In file included from extensions/gdal_wrap.cpp:3173:0:
From what I gather, the gcc can't find the GDAL headers, but it is specified in the command and I also did the including commands above:
CPLUS_INCLUDE_PATH=/usr/include/gdal
C_INCLUDE_PATH=/usr/include/gdal
Any ideas will be helpful!

Can't install uwsgi on cygwin

My main OS is windows 10 but I am using cygwin as a terminal. While installing uwsgi through pip3 install uwsgi command , it fails with an error message " AttributeError: module 'os' has no attribute 'uname'"
uWSGI needs a c compiler to build and the os.uname to use platform.uname needs to be updated in the uwsgiconfig.py file.
Here is how to fix for windows 10:
cd to uwsgi install directory and open uwsgiconfig.py
replace os.uname with platform.uname for the following lines of code:
uwsgi_os = os.uname()[0]
uwsgi_os_k = re.split('[-+_]', os.uname()[2])[0]
uwsgi_os_v = os.uname()[3]
uwsgi_cpu = os.uname()[4]
to this:
uwsgi_os = **platform.uname**()[0]
uwsgi_os_k = re.split('[-+_]', **platform.uname**()[2])[0]
uwsgi_os_v = **platform.uname**()[3]
uwsgi_cpu = **platform.uname**()[4]
Install the following packages with cygwin to make sure you have python3 and gcc available for cygwin terminal and not just python installed on windows. This is a separate python install than for windows itself.
Open windows cmd terminal
cd to cygwin64 (or your install dir)
run this command:
setup-x86_64.exe -q -P wget -P gcc-g++ -P gcc-core -P gcc-g++ -P libcrypt-devel -P libintl-devel -P python3 -P python3-devel
This command should install the following packages for Cygwin64:
gcc-core
gcc-g++
libcrypt-devel
libintl-devel
python3
python3-devel
In Cygwin terminal window
cd to uwsgi directory
type and run command 'python3 setup.py install'
wait for this to finish and do a happy dance.
If you get:
core/event.c: In function ‘event_queue_read’: core/event.c:1416:9: error: ‘UWSGI_EVENT_IN’ undeclared
probably you don't start setup install with cygwin python
Code need to be changed a bit to:
import platform
uwsgi_os = platform.uname()[0]
uwsgi_os_k = re.split('[-+_]', platform.uname()[2])[0]
uwsgi_os_v = platform.uname()[3]
uwsgi_cpu = platform.uname()[4]

Resources