How to check compatibility of packages in setup.py wihout installation? - setuptools

I use a setup.py to declare the python libraries to include in the package of my solution.
Is there a way to check the libraries compatibility using setup.py without installing the package? Because for now I can detect the conflicts only when I try to install my package.
Thank you

I think if I were you I would try with dephell. I don't think it will be able to give you a clear answer without tweaking, but it might help you get a bit closer to the info you are looking for. For example you could try these commands:
dephell deps check --from setuppy
-- https://dephell.readthedocs.io/cmd-deps-check.html
or
dephell deps tree --from setuppy
-- https://dephell.readthedocs.io/cmd-deps-tree.html

Related

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.

ViennaRNA package's Perl module RNA.pm is required

I am running a toolkit named RNA Framework that requires ViennaRNA to be installed.
I have installed the ViennaRNA 2.4.14 to run a function named rf-fold, However, I constantly receive this error:
[!] Error: ViennaRNA package's Perl module RNA.pm is required.
Please ensure that `ViennaRNA package v2.2.0` (or greater) is installed and try again
When I check the missing RNA.pm module, I can see it is in this path:
/home/user/ViennaRNA/lib/site_perl/5.28.0/
when I check which Perl I am using (type: which Perl) it gives me:
/home/user/perl5/perlbrew/perls/perl-5.28.0/bin/perl
I tried different ways to install the ViennaRNA, including conda install -c bioconda viennarna, compile and make install from ViennaRNA-2.4.14.tar.gz file from the official website. But I cannot get over this error.
I saw a similar issue here and there is a solution (https://www.perlmonks.org/?node_id=1052814), but I don't fully understand the content. Thanks in advance for any help and sorry if it is a basic question!
I think the RNA.pm come with the package, when you download ViennaRNA-2.4.14.tar.gz and install following this link.
So I found my RNA.pm is in the directory:
/share/apps/ViennaRNA-2.1.7/compile-install/lib/site_perl/5.14.2/x86_64-linux-thread-multi/RNA.pm
And I modified the PERL5LIB environment variable by :
export PERL5LIB=/share/apps/ViennaRNA-2.1.7/compile-install/lib/
Problem solved!

I have ClutterGdk, how to install ClutterGtk?

I'm curious about ClutterGtk, and want to see if GtkClutterEmbed could fit in my current task. But I have ClutterGdk in GI repository, and sudo apt-get install clutter-gtk isn't going to work.
I've found some resource around, but before trying them, I'd like to know if I'm missing the proper way to install.
edit
after suggestion by #jku, I tried
$ sudo apt-get install libclutter-gtk-1.0-0
but I get
...
libclutter-gtk-1.0-0 is already the newest version
so, since I cannot spot the related typelib in /usr/lib/girepository-1.0, what's going on ? Should I attempt to build the typelib by myself ?
The typelib files for GObject introspection on Debian are in the gir1.2-* packages.
Clutter-GTK's typelib file is provided by the gir1.2-gtkclutter-1.0 package.

Can anyone help me with installation of varnish vagent2

I want to install this varnish vagent2
https://github.com/varnish/vagent2
I am working around it but it is not installing.. it is giving me following error..
root#ns5 [/usr/local/src/vagent2-master]# ./autogen.sh
+ aclocal
configure.ac:65: error: pkg.m4 missing, please install pkg-config
configure.ac:65: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: error: echo failed with exit status: 1
now i have pkg-config / m4 / latest version of automake / autoconf installed...
yet it is giving this issue. Can anyone guide me as how can i get through the same ?
You're missing pkg.m4 it seems?
Check the spec files in the redhat/ directory to determine dependencies. We tested this on centos6 and I believe centos5, but I currently lack easy access to a machine to test from, so before I pursue this further, I suggest you check the spec file.
If that doesn't help, open an issue on github, as we don't generally follow stackoverflow :)
You need to install pkgconfig. On a mac, you may first need to install "mac ports" ... here is an article describing the solution:
http://www.fantageek.com/318/install-pkg-config-for-mac-osx/
Long story short. To get varnish-agent working happily on centos5 you needed to manually update automake and autoconf, which means that aclocal may not look into the right directory for pkg.m4.
Assuming you have installed pkgconfig using yum, line 22 in autogen.sh should look like this below.
aclocal -I /usr/share/aclocal
To make this a little easier, I have changed autogen.sh to include the above changes. See commit below, In addition, I have provided a Vagrantfile to illustrate how you can build a happy centos5 vm for varnish-agent. Hope this helps.
https://github.com/varnish/vagent2/commit/3921083f5fef12f06527e3361cc880121aa6b66b

installing perl module Class-Load-XS

I tried to install module Class-Load-XS-0.04 manually. I saw the following error:
$ perl Build.PL
Warning: ExtUtils::CBuilder not installed or no compiler detected
Proceeding with configuration, but compilation may fail during Build
However, the execution of perl -e 'use ExtUtils::CBuilder' was perfectly fine. I even tried to re-install ExtUtils::CBuilder, but it still does not work.
Could you please help?
I tried on my Win 7 machine, and it shows some warnings like this when I do perl Build.pl:
collect2: ld returned 1 exit status
Checking prerequisites...
requires:
! Class::Load is not installed
build_requires:
! Class::Load is not installed
! Module::Implementation is not installed
! Test::Fatal is not installed
! Test::Requires is not installed
ERRORS/WARNINGS FOUND IN PREREQUISITES. You may wish to install the versions
of the modules indicated above before proceeding with this installation
Then I installed the above mentioned modules, and things went fine then.
You may try install these modules first.
Hope it helps.
It looks to me like you don't have a compiler. Try this:
perl -e 'use ExtUtils::CBuilder; $cb = ExtUtils::CBuilder->new; print $cb->have_compiler ? "have\n" : "dont have\n";'
Can I guess that you are on Windows using ActiveState Perl? If so perhaps try Strawberry Perl which comes with a compiler.
Had a similar problem installing a different module (Win32::Mutex). This isn't a great fix, but it got the job done. From the build directory (e.g., ~/.cpan/build/The-Module-mYyzLx)
First, set the CC environment variable yourself
SET CC=C:\strawberry\c\bin\g++.exe [Windows]
export CC=/usr/bin/g++.exe [Cygwin]
and try to build (perl Build.PL, perl Build, ...). If it is still complaining about missing programs (g++, dlltool, etc.):
Second, copy pieces of your tool chain into the build directory
COPY C:\strawberry\c\bin\g++.exe . [Windows]
COPY C:\strawberry\c\bin\dlltool.exe .
cp /usr/bin/g++ . [Cygwin]
cp /usr/bin/dlltool .
If the build still complains about missing programs, copy those to your build directory too.
The fix and the symptoms are consistent with ExtUtils::CBuilder not being able to use the current PATH setting, though I have no idea what that would be so difficult.
I'd suggest installing these first:
apt-get install libc6-dev
and
apt-get install libtest-exception-perl
By the way you describe the problem it looks like you have these two perl modules missing. On the other hand it takes just a couple of seconds to double-check if those are installed, but these 'seconds' could help you save on a lot of head ache.