Install confluent-kafka avro with pip - python

I'm trying to install the avro package for confluent-kafka with python3 on macOs Sierra.
Installing the confluent-kafka package works fine, no issues. The problem is when I try to install the avro package:
pip install confluent-kafka[avro]
I just get an error message from the bash, saying:
no matches found: confluent-kafka[avro]
How can I install this package? Anyone else that have managed to do it on mac?

Assuming you are not using bash (in my case it was zsh), the [] might mess with your shell. The following should solve this:
pip install "confluent-kafka[avro]"
For me this worked with the default install from pypi, no need for the github URL.

Try installing directly from github
pip install git+git://github.com/confluentinc/confluent-kafka-python.git

Solved! In my case it was python version
I was using python 3.10.1 version
Uninstall python 3.10.1 and python Launcher from add or remove programs
Download python 3.7.0 for x64 bit using this link or download from here Link
Now you can: pip install confluent-kafka[avro]

Related

Unable to install pandas or other packages in linux virtual environment

I am unable to install module pandas in my linux vm. I tried all ways to install it, but it says it has version 1.1.5 requirement already satistied. But when I try running the code, it says, no module found. The latest version of python in it is 2.7.3, but I want to install 3.8 or 3.7, but I'm unable to. Where am I going wrong?
Did you try installing python3 from your package manager? You can install python 3.9 from apt using the below command
apt install python3 pip -y
You can also install the below package to use python in the terminal instead of python3 every time
apt install python-is-python3 -y
I cant comment yet so using the answer section, kindly give me an upvote so I can start using the comment feature, sorry for the trouble

Trouble installing packages in Python - ... is in an unsupported or invalid wheel

Hi I am trying to install win10toast and I get this message:
I had this error when I tried to download pywin32 previously, but why is this error popping up whenever I try to install any other package? I used to be able to install packages fine before with the same command
pywin32 is listed as a requirement for the package win10toast (link). So, when you are installing win10toast, pip also tries to install pywin32 which gives you an error.
From the looks of it, you are using a python 3.6 and a 32-bit system, both of which are supported by the latest release (pywin32 302). To resolve the pywin32 error, you could try the following.
Option 1: Considering there are multiple installs and python3 is mapped to python 3.6 installation. (You can check that using python --version)
Install using python -m pip install pypiwin32
If you had a prior successful install on pypiwin32, you could actually try to use: python Scripts/pywin32_postinstall.py -install
Option 2: Download the binary files and install - https://github.com/mhammond/pywin32/releases/tag/b302
Download the appropriate exe and install
Option 3: Download the source files and build:
Download the zip file from: https://github.com/mhammond/pywin32/releases/tag/b302
Unzip the file
Use the command python setup.py install
Update:
I was looking around the pywin32 github repo and found that the same issue is encountered by others too. While an official update is not rolled out, you can try the solution there:
you need to download the wheel found here
Install the whl manually using the command: python -m pip install C:/some-dir/pywin32-302.1-cp36-cp36m-win32.whl

Python pip not working with egg_info error [duplicate]

I'm trying to install some packages with pip.
But pip install unroll gives me
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\MARKAN~1\AppData\Local\Temp\pip-build-wa7uco0k\unroll\
How can I solve this?
About the error code
According to the Python documentation:
This module makes available standard errno system symbols. The value of each symbol is the corresponding integer value. The names and descriptions are borrowed from linux/include/errno.h, which should be pretty all-inclusive.
Error code 1 is defined in errno.h and means Operation not permitted.
About your error
Your setuptools do not appear to be installed. Just follow the Installation Instructions from the PyPI website.
If it's already installed, try
pip install --upgrade setuptools
If it's already up to date, check that the module ez_setup is not missing. If it is, then
pip install ez_setup
Then try again
pip install unroll
If it's still not working, maybe pip didn't install/upgrade setup_tools properly so you might want to try
easy_install -U setuptools
And again
pip install unroll
Here's a little guide explaining a little bit how I usually install new packages on Python + Windows. It seems you're using Windows paths, so this answer will stick to that particular SO:
I never use a system-wide Python installation. I only use virtualenvs, and usually I try to have the latest version of 2.x & 3.x.
My first attempt is always doing pip install package_i_want in some of my Visual Studio command prompts. What Visual Studio command prompt? Well, ideally the Visual Studio which matches the one which was used to build Python. For instance, let's say your Python installation says Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32. The version of Visual Studio used to compile Python can be found here, so v1500 means I'd be using vs2008 x64 command prompt
If the previous step failed for some reason I just try using easy_install package_i_want
If the previous step failed for some reason I go to gohlke website and I check whether my package is available over there. If it's so, I'm lucky, I just download it into my virtualenv and then I just go to that location using a command prompt and I do pip install package_i_want.whl
If the previous step didn't succeed I'll just try to build the wheel myself and once it's generated I'll try to install it with pip install package_i_want.whl
Now, if we focus in your specific problem, where you're having a hard time installing the unroll package. It seems the fastest way to install it is doing something like this:
git clone https://github.com/Zulko/unroll
cd unroll && python setup.py bdist_wheel
Copy the generated unroll-0.1.0-py2-none-any.whl file from the created dist folder into your virtualenv.
pip install unroll-0.1.0-py2-none-any.whl
That way it will install without any problems. To check it really works, just login into the Python installation and try import unroll, it shouldn't complain.
One last note: This method works almost 99% of the time, and sometimes you'll find some pip packages which are specific to Unix or Mac OS X, in that case, when that happens I'm afraid the best way to get a Windows version is either posting some issues to the main developers or having some fun by yourself porting to Windows (typically a few hours if you're not lucky) :)
It was resolved after upgrading pip:
python -m pip install --upgrade pip
pip install "package-name"
I got stuck exactly with the same error with psycopg2. It looks like I skipped a few steps while installing Python and related packages.
sudo apt-get install python-dev libpq-dev
Go to your virtual env
pip install psycopg2
(In your case you need to replace psycopg2 with the package you have an issue with.)
It worked seamlessly.
I got this same error while installing mitmproxy using pip3. The below command fixed this:
pip3 install --upgrade setuptools
Download and install the Microsoft Visual C++ Compiler for Python 2.7 from https://www.microsoft.com/en-in/download/details.aspx?id=44266 - this package contains the compiler and set of system headers necessary for producing binary wheels for Python 2.7 packages.
Open a command prompt in elevated mode (run as administrator)
Firstly do pip install ez_setup
Then do pip install unroll (It will start installing numpy, music21, decorator, imageio, tqdm, moviepy, unroll) # Please be patient for music21 installation
Python 2.7.11 64 bit used
Other way:
sudo apt-get install python-psycopg2 python-mysqldb
I had the same issue when installing the "Twisted" library and solved it by running the following command on Ubuntu 16.04 (Xenial Xerus):
sudo apt-get install python-setuptools python-dev build-essential
It's a dependency issue.
I tried running the following commands helped me sorting out the dependencies, in my case the dependency was
grpcio
pip3 install --upgrade pip
python3 -m pip install --upgrade setuptools
pip3 install --no-cache-dir --force-reinstall -Iv grpcio==1.36.1
pip3 install pulsar-client==2.7.0
remember you must have python3 installed in your system.
First try:
pip install unroll
For sure not work :)
Then Try:
pip2 install unroll
Still get error Try:
pip3 install unroll
If pip3 Worked then suggest to change configuration to use pip3 as pip because you will get a lot of issues as the modern now is Python3 = pip3 if you execute a script files.
I had the same problem.
The problem was:
pyparsing 2.2 was already installed and my requirements.txt was trying to install pyparsing 2.0.1 which throw this error
Context: I was using virtualenv, and it seems the 2.2 came from my global OS Python site-packages, but even with --no-site-packages flag (now by default in last virtualenv) the 2.2 was still present. Surely because I installed Python from their website and it added Python libraries to my $PATH.
Maybe a pip install --ignore-installed would have worked.
Solution: as I needed to move forwards, I just removed the pyparsing==2.0.1 from my requirements.txt.
I ran into the same error code when trying to install a Python module with pip.
#Hackndo noted that the documentation indicate a security issue.
Based on that answer, my problem was solved by running the pip install command with sudo prefixed:
sudo pip install python-mpd2
For me this worked
python3 -m pip3 install -U pip
you can also try
python -m pip install -U pip
pip3 install --upgrade setuptools
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with -m pip instead of running pip directly.
Use python3 -m pip "command", eg:
python3 -m pip install --user pyqt5
I tried all of the above with no success. I then updated my Python version from 2.7.10 to 2.7.13, and it resolved the problems that I was experiencing.
That means some packages in pip are old or not correctly installed.
Try checking version and then upgrading pip.Use auto remove if that works.
If the pip command shows an error all the time for any command or it freezes, etc.
The best solution is to uninstall it or remove it completely.
Install a fresh pip and then update and upgrade your system.
I have given a solution to installing pip fresh here - python: can't open file get-pip.py error 2] no such file or directory
next installation helps me:
pip3 install cython
This worked for me:
sudo xcodebuild -license
Upgrading Python to version 3 fixed my problem. Nothing else did.
I downloaded the .whl file from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and then did:
pip install scipy-0.19.1-cp27-cp27m-win32.whl
Note that the version you need to use (win32/win_amd-64) depends on the version of Python and not that of Windows.
I had this problem using virtualenvs (with pipenv) on my new development setup.
I could only solve it by upgrading the psycopg2 version from 2.6.2 to 2.7.3.
More information is at https://github.com/psycopg/psycopg2/issues/594
I faced the same problem with the same error message but on Ubuntu 16.04 LTS (Xenial Xerus) instead:
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-w71uo1rg/poster/
I tested all the solutions provided above and none of them worked for me. I read the full TraceBack and found out I had to create the virtual environment with Python version 2.7 instead (the default one uses Python 3.5 instead):
virtualenv --python=/usr/bin/python2.7 my_venv
Once I activated it, I run pip install unirest successfully.
try on linux:
sudo apt install python-pip python-bluez libbluetooth-dev libboost-python-dev libboost-thread-dev libglib2.0-dev bluez bluez-hcidump
Had the same problem on my Win10 PC with different packages and tried everything mentioned so far.
Finally solved it by disabling Comodo Auto-Containment.
Since nobody has mentioned it yet, I hope it helps someone.
I had the same problem and was able to fix by doing the following.
Windows Python needs Visual C++ libraries installed via the SDK to build code, such as via setuptools.extension.Extension or numpy.distutils.core.Extension. For example, building f2py modules in Windows with Python requires Visual C++ SDK as installed above. On Linux and Mac, the C++ libraries are installed with the compiler.
https://www.scivision.co/python-windows-visual-c++-14-required/
Following below command worked for me
[root#sandbox ~]# pip install google-api-python-client==1.6.4
Methods to solve setup.pu egg_info issue when updating setuptools or not other methods doesnot works.
If CONDA version of the library is available to install use conda instead of pip.
Clone the library repo and then try installation by pip install -e . or by python setup.py install
upgrading python's version did the work for me.
I have just encountered the same problem when trying to pip install -e . a new repo. I did not notice that the contents of setup.py haven't been saved properly and I was effectively running the command with an empty setup.py.
Hence you may experience the same error message if the setup.py of the target package is either empty or malformed.
I solved it on Centos 7 by using:
sudo yum install libcurl-devel

Install opencv-python under python3 ubuntu 14.04

I want to use opencv under python 3 in Ubunto 14.04. I plan to use the PyCharm IDE to develop my program.
Inside PyCharm I choose, I set:
File/Settings/Project:HelloWorld/Project Interpreter/3.4.3(/usr/bin/python3.4)
Python 3.4.3 is the default version of python in Ubunto 14.04.
Then I try to add opencv-python package:
File/Settings/Project:HelloWorld/Project Interpreter/+ (where you add the package)
and the system gives me this error:
Executed command:
pip install opencv-python
Try to run this command from the system terminal. Make sure that you
use the correct version of 'pip' installed for your Python interpreter located at '/usr/bin/python3.4'.
DEPRECATION: --no-install, --no-download, --build, and --no-clean are deprecated. See https://github.com/pypa/pip/issues/906.
Downloading/unpacking opencv-python
Could not find any downloads that satisfy the requirement opencv-python
Cleaning up...
No distributions at all found for opencv-python
Storing debug log for failure in /root/.pip/pip.log
the error is the same when I run the command from terminal. I believe the problem is related to installing opencv under python3 but I am not sure I know if I can fix it. Please let me know your opinion.
Thanks
The fix is to update your pip and try again. This worked for me.
So, first:
pip install --upgrade pip
after that:
pip install opencv-python
First, you should not use install opencv-python, this is not the official opencv package.
Please, see:
**SOLVED** How to include libgtk2.0-dev and pkg-config in cmake when installing openCV on Ubuntu 16
If you want to install opencv, you can follow this website, that worked for me. You might need to apapt some parts (mainly version numbers, and paths during the cmake process).
I also faced similar issue in the windows and pip upgrade worked for me,
pip install --upgrade pip
and install using below command,
pip install opencv-python
As far as I can see from querying pip (using pip search opencv) there is no package called opencv-python I think the one you're looking for is pyopencv.
this issue appears to be almost identical

Trying to install lxml for python, "Could not find function xmlCheckVersion in library libxml2." [duplicate]

I'm getting an error Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed? when trying to install lxml through pip.
c:\users\f\appdata\local\temp\xmlXPathInitqjzysz.c(1) : fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command 'C:\\Users\\f\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
I don't find any libxml2 dev packages to install via pip.
Using Python 2.7 and Python 3.x on x86 in a virtualenv under Windows 10.
Install lxml from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml for your python version. It's a precompiled WHL with required modules/dependencies.
The site lists several packages, when e.g. using Win32 Python 3.11, use lxml‑4.9.0‑cp311‑cp311‑win32.whl.
Download the file, and then install with:
pip install C:\path\to\downloaded\file\lxml‑4.9.0‑cp311‑cp311‑win32.whl
I had this issue and realised that whilst I did have libxml2 installed, I didn't have the necessary development libraries required by the python package. Installing them solved the problem:
sudo apt-get install libxml2-dev libxslt1-dev
sudo pip install lxml
Try to use:
easy_install lxml
That works for me, win10, python 2.7.
On Mac OS X El Capitan I had to run these two commands to fix this error:
xcode-select --install
pip install lxml
Which ended up installing lxml-3.5.0
When you run the xcode-select command you may have to sign a EULA (so have an X-Term handy for the UI if you're doing this on a headless machine).
In case anyone else has the same issue as this on
Centos, try:
yum install python-lxml
Ubuntu
sudo apt-get install -y python-lxml
worked for me.
set STATICBUILD=true && pip install lxml
run this command instead, must have VS C++ compiler installed first
https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/
It works for me with Python 3.5.2 and Windows 7
I tried install a lib that depends lxml and nothing works. I see a message when build was started: "Building without Cython", so after install cython with apt-get install cython, lxml was installed.
I had this issue and realized that while I did have libxml2 installed, I didn't have the necessary development libraries required by the python package.
1) Installing them solved the problem:
The site to download the file: Download
2) After Installing the file save it in a accessible folder
pip install *path to that file*
For some reason it doesn't work in python 3.11, but 3.10 works.
On windows, to install a module with a previous version, use
py -3.10 -m pip install lxml
if you want to install it in a venv, then use
py -3.10 -m venv .venv
.venv/Scripts/pip.exe install lxml
if you've set up the venv, then you can just use
pip install lxml
You also need to run the python program with that version. If you set up a venv, then you don't need to do this.
py -3.10 file.py
It is not strange for me that none of the solutions above came up, but I saw how the igd installation removed the new version and installed the old one, for the solution I downloaded this archive:https://pypi.org/project/igd/#files
and changed the recommended version of the new version: 'lxml==4.3.0' in setup.py
It works!
I got the same error for python 32 bit. After install 64bit, the problem was fixed.
I am using venv.
In my case it was enough to add lxml==4.6.3 to requirements.txt.
One library wanted earlier version and this was causing this error, so when I forced pip to use newest version (currently 4.6.3) installation was successful.

Categories