Poetry unable to find installation candidates for connectorx - postgresql

i'm using poetry version 1.2.2 and python 3.11
I want to read the sql query using polars like pl.read_sql()
but it requires the connectorx library.
I am able to install that library using pip install connectorx but poetry add connectorx is giving this error:
RuntimeError
Unable to find installation candidates for connectorx (0.3.1)
at ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\poetry\installation\chooser.py:103 in choose_for
99│
100│ links.append(link)
101│
102│ if not links:
→ 103│ raise RuntimeError(f"Unable to find installation candidates for {package}")
104│
105│ # Get the best link
106│ chosen = max(links, key=lambda link: self._sort_key(package, link))
107│
Tried clearing the cache of poetry
Tried adding into pyproject.toml

connectorx neither provide a wheel file for python 3.11 nor a source distribution from which a wheel could be build. See https://pypi.org/project/connectorx/#files
So there is no way to install it on python 3.11

Related

Snapml Not installing on windows

For a ML project on credit-card (ML with python coursera) I needed to import snapml. But unfortunately in pip install module its not unstalling.
Its showing -" error could not find a version that satisfies the requirement snapml"
and "error no matching distribuition found for snapml"
I also tried .whl file which also isnt working.
What should I do fix the issues?
Tried to install and didnt work

python 3.7.6 pip setup.py test with ContextualVersionConflict

my setup.py is like below:
from setuptools import find_packages, setup
tests_require = ['pytest-env', 'pytest-mock', 'pytest-cov', 'pytest-xdist', 'pytest', 'mock', 'moto<=1.3.10']
setup(
name='repo_name',
version='0.1.0',
description='repo_name',
keywords=['?'],
packages=find_packages('src', exclude=['tests', 'venv']),
package_dir={'': 'src'},
package_data={'': ['schema/*.yaml']},
install_requires=[
'boto3<=1.10.19',
'requests<=2.22.0',
'jsonschema<=3.0.1',
'objectpath<=0.6.1',
'pyyaml<=5.1.1',
'sqlalchemy<=1.3.5',
'psycopg2-binary<=2.8.3',
'auth-client<=1.0.23', # internal package
'policy_client<=1.0.9', # internal package
'audit-client<=1.1.20', # internal package
'flask<=1.1.1',
'click<=7.0',
'Werkzeug<=0.15.5',
'itsdangerous<=1.1.0',
'Jinja2<=2.10.1',
'MarkupSafe<=1.1.1',
'structlog<=19.2.0',
'python-rapidjson<=0.9.1'
],
setup_requires=['pytest-runner'],
tests_require=tests_require,
extras_require={'test': tests_require},
include_package_data=True,
zip_safe=False
)
When I run python setup.py test, it will always reinstall the most of the packages that I already installed into .eggs folder, which I understand. While it's installing the package with different versions that I provided in the install_requires section, which results in below error:
pkg_resources.ContextualVersionConflict: (urllib3 1.25.10 (/Users/***/Desktop/repo/.eggs/urllib3-1.25.10-py3.7.egg), Requirement.parse('urllib3<1.25,>=1.21.1'), {'requests'})
I have to pin the requests version to 2.22.0 which requires urllib3 version no larger than 1.25, which caused my issue. So, is there anyway I can pin the urllib3 version in somewhere so when it runs, it will only install the provided version? I have tried to add the urllib3 version in install_requires, tests_require and in requirements.txt, but no luck so far.
Probably not what you want to hear but... setup_requires and tests_require are deprecated. Although they (probably) still work (mostly) fine, you might want to look for alternative solutions. As far as I know the most common alternative solutions are to use Tox instead of tests_require and PEP 517 to replace setup_requires.
In your case, it seems that your usage of setup_requires is only a consequence of your usage of tests_require. So by switching to something like Tox you get rid of both tests_require and setup_requires.
I got it resolve to simply replace python setup.py test to be pip instll -e . [test], and then pytest directly.
It will still install all the tests_require packages and then run pytest directly. Instead of going through all the list packages and find the best match versions for all packages.
UPDATES:
The real problem is I did not remove the old .eggs/ and venv/ folder when I made the packages version change. So the solution is updating the requests version to be 2.21.0 in the setup.py file, then remove the .eggs/ and venv/ folder and rerun everything.

Installing python program in AWS Elastic Beanstalk with Postgresql gives pg_config error

I've created a python application which uses Postgresql. I used psycopg2 library (v 2.8.4) when doing the development, but when trying to install it on the beanstalk, it gives the following error:
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
Anyone have idea how to solve this?
Found the answer to the question. Instead of installing the psycopg2 directly, use psycopg2-binary==2.8.4.
Similar question is also being asked here

ModuleNotFoundError: No module named 'cartopy' when import SkewT from metpy.plots under Python3

When trying to import SkewT into my python3 code on a Mac (Mojave 10.14.6):
from metpy.plots import SkewT
I get the error:
ModuleNotFoundError: No module named 'cartopy'
pip3 install cartopy gives the output
Collecting cartopy
Downloading https://files.pythonhosted.org/packages/e5/92/fe8838fa8158931906dfc4f16c5c1436b3dd2daf83592645b179581403ad/Cartopy-0.17.0.tar.gz (8.9MB)
|████████████████████████████████| 8.9MB 616kB/s
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Complete output from command /usr/local/opt/python/bin/python3.7 /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpj50b1vfe:
ERROR: setup.py:171: UserWarning: Unable to determine GEOS version. Ensure you have 3.3.3 or later installed, or installation may fail.
'.'.join(str(v) for v in GEOS_MIN_VERSION), ))
Proj 4.9.0 must be installed.
----------------------------------------
ERROR: Command "/usr/local/opt/python/bin/python3.7 /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpj50b1vfe" failed with error code 1 in /private/tmp/pip-install-b5cu8485/cartopy
To start, I tried to install Proj and geos, but pip3 only lists version 0.1.0 for proj and 0.2.2 for geos. Before I get too far down this rabbit hole, I thought I'd see if anyone else has encountered this problem. Thanks!
So it looks like MetPy 0.10 accidentally picked up a hard dependency on CartoPy, which we did not really plan. You can track our resolution of that here.
CartoPy depends on a lot of compiled libraries that are not pip-installable unfortunately. Your best bet is to look at CartoPy's install instructions. If you're using Anaconda or Canopy, those distributions have pre-built CartoPy packages available.
One option to work around this is to install MetPy 0.9:
pip install metpy==0.9
Do you use Conda? The easiest way to remedy this problem is to install CartoPy (or MetPy for that manner) via conda, so that all of the right dependencies are also downloaded: conda install -c conda-forge cartopy or conda install -c conda-forge metpy. Pip doesn't bring all of them together, so that leads to this problem being raised.
Thanks. Without conda, I was also able to complete this (more painful) installation:
- brew install geos
- brew install proj
- pip3 install cython
- pip3 install git+https://github.com/SciTools/cartopy.git#master 
(see http://louistiao.me/posts/installing-cartopy-on-mac-osx-1011/)

gdcmanon - Requested cryptoraphic library not configured

I am using gdcmanon to anonimize dicom files like the following:
LD_LIBRARY_PATH=../lib ./gdcmanon --certificate CA_cert.cer -e ./dump ./dump/anon
But it gives the following error:
Error: In /home/travis/build/malaterre/GDCM/Source/Common/gdcmCryptoFactory.cxx, line 61, function static gdcm::CryptoFactory* gdcm::CryptoFactory::GetFactoryInstance(gdcm::CryptoFactory::CryptoLib)
No crypto factory registered with id 1
Requested cryptoraphic library not configured.
How can I solve this?
The error is because of binaries you use, it looks like SSL dependencies are not satisfied.
As a solution (workaround?), you can get the binaries via apt system. For Ubuntu 16.04 Xenial distribution, there is version 2.6.3 of libgdcm-tools package.
Another possibility is to compile gdcm from scratch, but you need development files of OpenSSL (apt install libssl-dev). Moreover, to use anonymisation with certificates, in CMake system set GDCM_USE_SYSTEM_OPENSSL=YES.