newbie installing aerospike client to both my python versions - aerospike

I just followed the instructions on the site and installed aerospike (on linux mint). I'm able to import the aerospike python client module from python 2.7 but not from 3.6 (newly installed). I'm thinking that I need to add the directory to my "python path" perhaps??, but having difficulty understanding how this works. I want to be able to run aerospike and matplotlib in 3.6.

You should use pyenv to allow yourself to have multiple versions of Python locally, each with their own pip repo. This allows you to switch easily between versions (similar to RVM for Ruby, NVM for Node.js).
For example:
pyenv install -l
pyenv shell 2.7.10 && pyenv local 2.7.10 && pyenv global 2.7.10 && pyenv rehash
pip install aerospike
pyenv shell 3.4.3 && pyenv local 3.4.3 && pyenv global 3.4.3 && pyenv rehash
pip install aerospike

Also see https://discuss.aerospike.com/t/large-memory-usage-by-python-driver-on-big-batch-insert/3819/4 - an update to python3 client is in the works to address a mem leak issue per the issues link in that post.

I figured it out. I just needed to use pip3 instead of pip to install it to correct version of python (though I was only able to get it onto 3.5, not 3.6 for some reason).

Related

Python3.10 source venv has changed

I went to do some python leetcode on a personal repo and after I upgraded my Kubuntu to 22.04 I realized the current venv wasn't working.
I had figured I would need to recreate the venv.
Installed python3.10-venv but I cant source and activate it.
In fact venv/bin/activate doesn't exist anymore.
The folder only contains three files
python python3 python3.10
I had tried but no dice
source venv/bin/python3.10
So naturally source venv/bin/activate doesn't work. Ideas?
I've installed Ubuntu 22.0.4 and I've had the same problem as yours and I solved that problem in this way.
install venv:
sudo apt-get update
sudo apt-get install python3-virtualenv
Create venv:
virtualenv --python=/usr/bin/python3.10 (VENV-NAME)
python3.10 -m venv (VENV-NAME)
source (VENV-NAME)/bin/activate
check & update pip:
pip list
and update pip for example(in my pc):
(/home/amin/Desktop/prog/Django/moein/coffeinrider.com/Project/A/(VENV-NAME)/bin/python3.10 -m pip install --upgrade pip)
When trying to create a virtual env using venv for Python, a version of Python that is already installed system-wide must be used, but a version of the venv library from the system must also be used. These are two pre-requisites for setting up a virtual environment.
WARNING: I did this in a hurry because I needed it but please be warned: this may break your system Python with a result that applications that rely on it may break.
The problem I had, matching symptoms given here, seems to be that when trying to create a venv using Python 3.10.8, the venv module for Python 3.8.10 was being used.
So, given Python 3.8 and Python 3.10 are already installed using apt, first of all I uninstalled these packages:
sudo apt purge python3-venv python3.8-venv
sudo apt autoremove
Then I linked python3 to point to Python 3.10:
cd /usr/bin
sudo rm python3
sudo ln python3.10 python3
Then I installed the venv for Python3.10:
sudo apt install python3.10-venv
This now means creating a virtual environment for Python 3.8 doesn't work (because Python3.8 venv has just been removed). I'm not sure if there is a means to have them both working, and I haven't yet tried to just install python3.8-venv again and try them both, as I need my 3.10 environment working quickly, right now ;-). But it seems possible there has been some conflict introduced when following the usual upgrade route within Ubuntu 20.
However, venv for Python 3.10 should now work as expected:
$ python3 -m venv .venv
$ source .venv/bin/activate
(.venv) $ python -V
Python 3.10.8
(.venv) $ pip install --upgrade pip
...
(.venv) $ pip list
Package Version
---------- -------
pip 22.3
setuptools 63.2.0
It has been updated to source venv/local/bin/activate

How to install tensorflow on m1 mac using pipenv

In our project we use pipenv and I can't switch everyone on conda.
I'm using python 3.9 and pipenv. I tried to install pipenv inside conda env, but it didn't work well
Ensure you have Xcode Command Line Tools installed by executing xcode-select -p.
Install HDF5 library using Homebrew and h5py without binaries.
brew install hdf5
export HDF5_DIR="$(brew --prefix hdf5)"
export PIP_NO_BINARY=h5py && pipenv install h5py
Install TF
pipenv install tensorflow-macos
pipenv install tensorflow-metal
Skip tensorflow-deps and install any missing libraries manually. You can find some more details in this blog post.

Downloading PostgreSQL Mac Download Error

could you please advise me of a solution you may know for downloading PostgreSQL. I am trying to install 9.6.5 version, but also tried the 10.0, same error.
I am using an installation option for Mac operating system OS Sierra from website: https://www.openscg.com/bigsql/postgresql/installers.jsp/
I am getting an error:
Have tried to run the instruction sudo easy_install pip in the command line and it installs the pip file successfully. However I am still unable to install the PostgreSQL.
Please could you advise what the issue may be?
I have also installed Homebrew (it did not help).
I do already have anaconda and Python installed, as well as latest versions of R and RStudio.
I have now found a solution to the above problem (on Mac). Execute the following command in your terminal:
sudo easy_install-2.6 pip
If that does not work execute:
sudo easy_install-2.7 pip
This allows the PostgreSQL to be downloaded correctly.
I followed the instructions suggesting using easy_install-2.7 but still got an error very similar to that from the OP. I had to specifically install pip 9.0.0 with
sudo easy_install-2.7 pip=9.0.0
after which the PostgreSQL install worked.
The default pip is now v10, so it's probably a string compare issue in the installer.
Here is the solution that worked for me on Mac High Sierra 10.13.4:
Clear out the brew cache $ rm -rf ~/Library/Caches/Homebrew
Clear out the site-packages $ sudo rm -rf /usr/local/lib/python2.7/site-packages
Reinstall Python $ brew reinstall python This pulls down python-3.5.6.high_sierra and put it in /usr/local/bin/python3
But which python still shows /usr/bin/python
The solution is to run $ brew install python#2 which pulls down python#2-2.7.14_3.high_sierra
Now which python shows the correct path /usr/local/bin/python which is also where all your pip stuff is installed, so now pip will work.
Ensure the latest version of pip is installed with $ sudo pip install --upgrade pip

How to download previous version of tensorflow?

For some reason, I want to use some previous version of tensorflow('tensorflow-**-.whl', not source code on github) and where can I download the previous version and how can I know the corresponding cuda version that is compatible.
It works for me, since I have 1.6
pip install tensorflow==1.5
Find available versions (some example results shown):
$ curl -s https://storage.googleapis.com/tensorflow |xmllint --format - |grep whl
<Key>linux/gpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl</Key>
<Key>linux/gpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl</Key>
<Key>linux/gpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl</Key>
<Key>linux/gpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl</Key>
You can, of course, filter the results further by piping through additional instances of grep.
Pick the version you want and install for Python with pip...
$ TFVERSION=linux/gpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl
$ pip install https://storage.googleapis.com/tensorflow/$(TFVERSION)
Note: cp27 in the list above indicates compatibility with Python version 2.7.
The above answer does not work any more.
You can install like this:
curl -s https://storage.googleapis.com/tensorflow |xmllint --format - |grep whl
<Key>linux/gpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl</Key>
<Key>linux/gpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl</Key>
<Key>linux/gpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl</Key>
<Key>linux/gpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl</Key>
Then pick the model you want.
Then you can run this kind of command :
# Mac OS X, CPU only, Python 2.7:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.11.0-py2-none-any.whl
Then install Tensorflow:
# Python 2
$ sudo pip install --upgrade $TF_BINARY_URL
# Python 3
$ sudo pip3 install --upgrade $TF_BINARY_URL
Source: https://www.tensorflow.org/versions/r0.11/get_started/os_setup#download-and-setup
You can do as suggested beforehand and search for available version in tesorflow site but you can't access versions older than available there.
So if you want an earlier version:
go to https://github.com/tensorflow/tensorflow
search for the version you want under branches - for instance r0.11
Then go to the download and setup section. Again, for r0.11: https://github.com/tensorflow/tensorflow/blob/r0.11/tensorflow/g3doc/get_started/os_setup.md and install as described there.
To download an older version of TensorFlow make sure you are using an older version of python as well. Otherwise, you will run into an issue like no version satisfying requirement found.
Create a virtual environment for this and install python==3..5
Use pip install tensorflow==1.4 or so.
Goto https://www.tensorflow.org/versions/
Click on the version you want, for example: https://www.tensorflow.org/versions/r1.1/
Click on install, for example: https://www.tensorflow.org/versions/r1.1/install/
Then follow your preferred way to install
in order to find out available previous versions all you need to do is either use :
pip search tensorflow-gpu or pip search tensorflow
conda search tensorflow-gpu or conda search tensorflow
and to install them even:
pip install tensorflow-gpu==1.15.0 or pip install tensorflow==1.15.0
conda install tensorflow-gpu==1.15.0 or conda install tensorflow==1.15.0
my experience conda search is much much cleaner and easier to find packages.
You can always download the previous version of tensorflow version
from here
Here on the top left you can change the version

How to install Numpy without compiling the sources

I have a project running on CentOS7 that uses Numpy.
The problem is that it takes a very huge amount of time to install this dependency.
I therefore tried to yum install numpy libs before pip install it.
So I run:
yum install numpy-1.7.1
pip install numpy==1.7.1 # This pip is executed in a virtualenv
The yum install installs the packaged library, and is quite fast to be performed.
The weird thing is that the pip install command re-compile all the sources. This is strange because, from my understanding, the pip install shall only add the python bindings on the compiled lib previously installed.
Any idea to get this library installed without to have everything recompiled?
I solved it by symlinking the 'global lib' (installed by yum install) into the virtual env:
ln -s /lib64/python2.7/site-packages/numpy $VENV/lib64/python2.7/site-packages/numpy
ln -s /lib64/python2.7/site-packages/numpy-1.7.1-py2.7.egg-info $ENV/lib64/python2.7/site-packages/numpy-1.7.1-py2.7.egg-info