Cannot pip install SolrClient (python2.6 vs 3.4 issues?) - solr

I am trying to pip install SolrClient, and I believe I am having some difficulty with my version of python.
Here is the error message.
[root#centos64 ~]# pip install SolrClient
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting SolrClient
Using cached SolrClient-0.1.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-UeQsqQ/SolrClient/setup.py", line 4, in <module>
import SolrClient
File "SolrClient/__init__.py", line 1, in <module>
from .solrclient import SolrClient
File "SolrClient/solrclient.py", line 10, in <module>
from .collections import Collections
File "SolrClient/collections.py", line 7, in <module>
from collections import defaultdict
ImportError: cannot import name defaultdict
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-UeQsqQ/SolrClient/
So, when I go to check my python version, it is 2.6
[root#centos64 ~]# python -V
Python 2.6.6
I've got python 3.4 on my machine, albeit I need to call it like this
[root#centos64 ~]# python3.4 -V
Python 3.4.3
So, a few questions.
Am I correct in my assumption that my error is due to the fact that I am attempting to pip install using python2.6?
If so, how do I either
a) tell pip to use the python3.4 version? (not sure if this is the right way of thinking about it)
b) adjust my system to use python3.4
Otherwise, I am not sure how to proceed here. Thoughts?

I did indeed need to use python3.4
As suggested, I went with a virtual environment for the task.
pip install pew
pew new -p `which python3.4` 3.4
pew workon 3.4
pip install SolrClient

sudo apt install virtualenv
virtualenv -p python3 <envname>
cd <envname>
source bin/activate
pip install SolrClient

Related

Error when running pip install discord.py

I am on a mac OS with python 3.5.3
I am completely new to python.
This is the command line when I try to run pip install discord.py
ERROR: Command errored out with exit status 1:
command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/7k/_5tkn2z940bfbjwc6jxhdvb40000gp/T/pip-install-HvXx9C/aiohttp/setup.py'"'"'; __file__='"'"'/private/var/folders/7k/_5tkn2z940bfbjwc6jxhdvb40000gp/T/pip-install-HvXx9C/aiohttp/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/7k/_5tkn2z940bfbjwc6jxhdvb40000gp/T/pip-pip-egg-info-Zb_d0r
cwd: /private/var/folders/7k/_5tkn2z940bfbjwc6jxhdvb40000gp/T/pip-install-HvXx9C/aiohttp/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/7k/_5tkn2z940bfbjwc6jxhdvb40000gp/T/pip-install-HvXx9C/aiohttp/setup.py", line 60, in <module>
raise RuntimeError("aiohttp requires Python 3.4.2+")
RuntimeError: aiohttp requires Python 3.4.2+
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
This is because your pip command is pointing to Python 2. discord.py requires Python 3.4.2 or higher. Try using:
pip3 install discord.py

Traceback (most recent call last): File "./odoo-bin", line 5, in <module>

Traceback (most recent call last):
File "./odoo-bin", line 5, in
import odoo
File "/opt/odoo/odoo/odoo/init.py", line 73, in
import babel
ModuleNotFoundError: No module named 'babel'
In Odoo should install first all requirements
Navigate to your project folder then try to run this command in terminal
pip install -r requirements.txt
If get any error while this command execution, resolve that errors then only Odoo server work.
If you use multi version of python
Check version:
python --version
e.g For me: Python 3.7.7
py -3.7 -m pip install -r requirements.txt

Installing pyodbc for Python 3.3 on windows (can't use pip)?

I'm trying to connect to the Microsoft SQL server.
I'm using python code to do so, and I want to download pyodbc.
I go to the Python33 directory by doing this: cd C:\Python33\, and I try typing in pip install pyodbc, but it doesn't recognize pip.
Did anyone else have this problem with Python 3.3?
I'm also trying to do this:
C:\Python34\Scripts>pip install pyodbc
But it says: "The system cannot find the path specified."
Pip is a stand-alone tool, you will have to install that as well in 3.3. Here is a link on a really good explanation:
(How do I install pip on Windows?)
In 3.4, pip was included, but you will have to call it with
python -m pip
inside your scripts directory

Syntax Error in google-api-python-client

While attempting to follow the Appengine quickstart the following error message appears:
httplib2/__init__.py", line 352
print('%s:' % h, end=' ', file=self._fp)
^
SyntaxError: invalid syntax
I had the same issue but my solution was to run pip in a virtual environment for the correct Python version, in my case it was 2.7.
virtualenv --python=python2.7 .venv27
source .venv27/bin/activate
pip2.7 install -r requirements.txt -t lib
When installing google-api-python-client, the following is recommended:
pip install -t lib google-api-python-client
If this command is used in an enviornment running python 3, the lib installed copy will fail.
Better to explicily state pip2:
pip2 install -t lib google-api-python-client

libcouchbase on ubuntu 14 errors

I cloned https://github.com/couchbase/libcouchbase and checkout to version 2.5.8. After that I compiled it as in the documentation from the git page
$ git clone git://github.com/couchbase/libcouchbase.git
$ cd libcouchbase && mkdir build && cd build
$ ../cmake/configure
$ make
$ sudo make install
Afterwords, I installed couchbase from pip:
sudo pip3 install couchbase
But when I do:
python3 -c 'import couchbase'
I've got
import couchbase._libcouchbase as C
ImportError: libcouchbase.so.2: cannot open shared object file: No such file or directory
I made a link in /usr/lib/libcouchbase.so.2 to /usr/local/lib/libcouchbase.so.2
sudo ln -s /usr/local/lib/libcouchbase.so.2 /usr/lib/libcouchbase.so.2
but now I get
import couchbase._libcouchbase as C
ImportError: /usr/local/lib/python3.4/dist-packages/couchbase/_libcouchbase.cpython-34m.so: undefined symbol: lcb_n1x_list
Linux version:
cat /etc/issue
Ubuntu 14.04.2 LTS \n \l
Any idea?
You're encountering this error because your version of libcouchbase is not recent enough to correspond to your version of the Couchbase Python SDK. The current version of the Couchbase Python SDK (2.0.9) requires libcouchbase>=2.6.0.
You have two options to handle this:
Use an older version of the Couchbase Python SDK
Update to the newer version of libcouchbase
Using an older version of the Python SDK is easily done with pip:
$ sudo pip3 install couchbase==2.0.8
Installing a newer version of libcouchbase would be similar to the procedure you've already taken, except you would of course need to checkout version 2.6.0.
That being said, it is generally recommended to use the official builds distributed on the Couchbase website. You can either download tars from the libcouchbase downloads page or add the official Couchbase repositories and apt-get install libcouchbase.

Resources