Python Easy To Code
IF you can install the required modules
I was thinking to myself tonight here at 1AM wondering why do I hate Python sometimes and dread using it? Why does nothing work in Python and why can I Google a million errors I’m having and find others are having them to? What does this remind me of ?
Is it Java? No, nothing is as bad as Java, but does anyone still know what PERL is? It was a contender under PHP blew it out of the water. The reason being that PHP was simple to setup for the most part. It wasn’t so difficult to get modules for MySQL and other things.
Now, granted Python has a lot more functionality and flexibility than virtually any language but this is where in a bad way it has more in common with PERL and it’s evil CPAN.
I’ve spent more time troubleshooting the Python environment than the actual coding. Coding is not the hard part, it’s wondering in which OS and version of Python, PIP, setuptools etc.. are going to let everything work. Or will you accidentally break Python in the process?
#even with fabric installed it doesn’t have the python module
Traceback (most recent call last):
File “./cpub.py”, line 14, in <module>
from fabric import network
ImportError: No module named ‘fabric’
I’m sure a lot of people will read this and say “the above looks like a n00b mistake” but alas I have tried installing fabric in fact I installed Version 1, 2 and 3 and neither combination has fixed anything.
Here is some random output while being in the process of trying to resolve the import error from fabric. Keep in mind this is one example only, I’ve run into this sort of endless thing on virtually any Python script you find on Github. This is too PERL like and if anything “too Linux package like” where you find that sometimes certain packages won’t work or are incompatible. Python really just needs a simple standardized API like real programming languages whether we are talking C, C++, C# etc…
File “/tmp/pip_build_one/cryptography/setup.py”, line 28, in <module>
“cryptography requires setuptools 18.5 or newer, please upgrade to a ”
RuntimeError: cryptography requires setuptools 18.5 or newer, please upgrade to a newer version of setuptools
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File “<string>”, line 17, in <module>
File “/tmp/pip_build_one/cryptography/setup.py”, line 28, in <module>
“cryptography requires setuptools 18.5 or newer, please upgrade to a ”
RuntimeError: cryptography requires setuptools 18.5 or newer, please upgrade to a newer version of setuptools
—————————————-
Cleaning up…
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_one/cryptography
Storing debug log for failure in /tmp/tmp5DYrAQ
pip install setuptools –upgrade
Downloading/unpacking setuptools from https://files.pythonhosted.org/packages/ff/f4/385715ccc461885f3cedf57a41ae3c12b5fec3f35cce4c8706b1a112a133/setuptools-40.0.0-py2.py3-none-any.whl#sha256=d68abee4eed409fbe8c302ac4d8429a1ffef912cd047a903b5701c024048dd49
Downloading setuptools-40.0.0-py2.py3-none-any.whl (567kB): 567kB downloaded
Installing collected packages: setuptools
Found existing installation: setuptools 3.3
Not uninstalling setuptools at /usr/lib/python2.7/dist-packages, owned by OS
Can’t roll back setuptools; was not uninstalled
Cleaning up…
Exception:
Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/pip/basecommand.py”, line 122, in main
status = self.run(options, args)
File “/usr/lib/python2.7/dist-packages/pip/commands/install.py”, line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File “/usr/lib/python2.7/dist-packages/pip/req.py”, line 1436, in install
requirement.install(install_options, global_options, *args, **kwargs)
File “/usr/lib/python2.7/dist-packages/pip/req.py”, line 672, in install
self.move_wheel_files(self.source_dir, root=root)
File “/usr/lib/python2.7/dist-packages/pip/req.py”, line 902, in move_wheel_files
pycompile=self.pycompile,
File “/usr/lib/python2.7/dist-packages/pip/wheel.py”, line 206, in move_wheel_files
clobber(source, lib_dir, True)
File “/usr/lib/python2.7/dist-packages/pip/wheel.py”, line 193, in clobber
os.makedirs(destsubdir)
File “/usr/lib/python2.7/os.py”, line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: ‘/usr/local/lib/python2.7/dist-packages/pkg_resources’
Storing debug log for failure in /tmp/tmpsCjKHL
Traceback (most recent call last):
File “/usr/local/bin/pip”, line 7, in <module>
from pip._internal import main
File “/usr/local/lib/python2.7/dist-packages/pip/_internal/__init__.py”, line 42, in <module>
from pip._internal import cmdoptions
File “/usr/local/lib/python2.7/dist-packages/pip/_internal/cmdoptions.py”, line 16, in <module>
from pip._internal.index import (
File “/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py”, line 15, in <module>
from pip._vendor import html5lib, requests, six
File “/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py”, line 86, in <module>
from pip._vendor.urllib3.contrib import pyopenssl
File “/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py”, line 46, in <module>
import OpenSSL.SSL
File “/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py”, line 8, in <module>
from OpenSSL import rand, crypto, SSL
File “/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py”, line 105, in <module>
SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: ‘module’ object has no attribute ‘SSL_ST_INIT’
python -m easy_install –upgrade pyOpenSSL
pip uninstall pycrypto fabric
Uninstalling fabric-2.2.1:
Would remove:
/usr/bin/fab
/usr/local/bin/fab
/usr/local/lib/python2.7/dist-packages/fabric-2.2.1.dist-info/*
/usr/local/lib/python2.7/dist-packages/fabric/*
Proceed (y/n)? y
Successfully uninstalled fabric-2.2.1
Cannot uninstall ‘pycrypto’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
panflute 1.10.6 requires shutilwhich, which is not installed.
pypandoc-course-pub 0.0.1 requires LinkChecker, which is not installed.
fabdocker 0.3.5 has requirement Fabric==1.10.1, but you’ll have fabric 1.14.0 which is incompatible.
bearychat-py 0.3.1 has requirement requests>=2.4.2, but you’ll have requests 1.2.0 which is incompatible.
sphinx 1.7.6 has requirement requests>=2.0.0, but you’ll have requests 1.2.0 which is incompatible.
fabric-remote 0.0.2 has requirement Fabric==1.8.1, but you’ll have fabric 1.14.0 which is incompatible.
fab-classic 1.15.1 has requirement paramiko<3.0,>=2.0, but you’ll have paramiko 1.18.5 which is incompatible.
pygithub 1.40 has requirement requests>=2.14.0, but you’ll have requests 1.2.0 which is incompatible.
oslo-serialization 2.27.0 has requirement pbr!=2.1.0,>=2.0.0, but you’ll have pbr 1.10.0 which is incompatible.
oslo-i18n 3.21.0 has requirement pbr!=2.1.0,>=2.0.0, but you’ll have pbr 1.10.0 which is incompatible.
loom 0.0.18 has requirement fabric==1.6.1, but you’ll have fabric 1.14.0 which is incompatible.
debtcollector 1.20.0 has requirement pbr!=2.1.0,>=2.0.0, but you’ll have pbr 1.10.0 which is incompatible.
pyasn1-modules 0.2.2 has requirement pyasn1<0.5.0,>=0.4.1, but you’ll have pyasn1 0.1.7 which is incompatible.
cheffab 0.0.2 has requirement Fabric==1.6.0, but you’ll have fabric 1.14.0 which is incompatible.
oslo-utils 3.36.4 has requirement pbr!=2.1.0,>=2.0.0, but you’ll have pbr 1.10.0 which is incompatible.
stevedore 1.29.0 has requirement pbr!=2.1.0,>=2.0.0, but you’ll have pbr 1.10.0 which is incompatible.
deploytool 1.3 has requirement Fabric==1.13.2, but you’ll have fabric 1.14.0 which is incompatible.
fabric-bolt 0.1 has requirement fabric<1.11,>=1.10.2, but you’ll have fabric 1.14.0 which is incompatible.
fabric-bolt 0.1 has requirement requests<2.8,>=2.7.0, but you’ll have requests 1.2.0 which is incompatible.
automation 0.6.1 has requirement Fabric==1.7.0, but you’ll have fabric 1.14.0 which is incompatible.
fabric2 2.2.1 has requirement paramiko>=2.4, but you’ll have paramiko 1.18.5 which is incompatible.
fabric3 1.14.post1 has requirement paramiko<3.0,>=2.0, but you’ll have paramiko 1.18.5 which is incompatible.
Successfully built future shutilwhich LinkChecker
fabdocker 0.3.5 has requirement Fabric==1.10.1, but you’ll have fabric 1.14.0 which is incompatible.
loom 0.0.18 has requirement fabric==1.6.1, but you’ll have fabric 1.14.0 which is incompatible.
fab-classic 1.15.1 has requirement paramiko<3.0,>=2.0, but you’ll have paramiko 1.18.5 which is incompatible.
cheffab 0.0.2 has requirement Fabric==1.6.0, but you’ll have fabric 1.14.0 which is incompatible.
cheffab 0.0.2 has requirement requests==1.2.0, but you’ll have requests 2.19.1 which is incompatible.
oslo-serialization 2.27.0 has requirement pbr!=2.1.0,>=2.0.0, but you’ll have pbr 1.10.0 which is incompatible.
oslo-i18n 3.21.0 has requirement pbr!=2.1.0,>=2.0.0, but you’ll have pbr 1.10.0 which is incompatible.
debtcollector 1.20.0 has requirement pbr!=2.1.0,>=2.0.0, but you’ll have pbr 1.10.0 which is incompatible.
pyasn1-modules 0.2.2 has requirement pyasn1<0.5.0,>=0.4.1, but you’ll have pyasn1 0.1.7 which is incompatible.
oslo-utils 3.36.4 has requirement pbr!=2.1.0,>=2.0.0, but you’ll have pbr 1.10.0 which is incompatible.
fabric-remote 0.0.2 has requirement Fabric==1.8.1, but you’ll have fabric 1.14.0 which is incompatible.
stevedore 1.29.0 has requirement pbr!=2.1.0,>=2.0.0, but you’ll have pbr 1.10.0 which is incompatible.
deploytool 1.3 has requirement Fabric==1.13.2, but you’ll have fabric 1.14.0 which is incompatible.
fabric-bolt 0.1 has requirement fabric<1.11,>=1.10.2, but you’ll have fabric 1.14.0 which is incompatible.
fabric-bolt 0.1 has requirement requests<2.8,>=2.7.0, but you’ll have requests 2.19.1 which is incompatible.
automation 0.6.1 has requirement Fabric==1.7.0, but you’ll have fabric 1.14.0 which is incompatible.
fabric2 2.2.1 has requirement paramiko>=2.4, but you’ll have paramiko 1.18.5 which is incompatible.
fabric3 1.14.post1 has requirement paramiko<3.0,>=2.0, but you’ll have paramiko 1.18.5 which is incompatible.
Installing collected packages: future, shutilwhich, requests, LinkChecker
Found existing installation: requests 1.2.0
Uninstalling requests-1.2.0:
Successfully uninstalled requests-1.2.0
Successfully installed LinkChecker-9.3 future-0.16.0 requests-2.19.1 shutilwhich-1.1.0
pip install requests –upgrade
Requirement already up-to-date: requests in /usr/local/lib/python2.7/dist-packages (2.19.1)
Requirement not upgraded as not directly required: idna<2.8,>=2.5 in /usr/local/lib/python2.7/dist-packages (from requests) (2.6)
Requirement not upgraded as not directly required: certifi>=2017.4.17 in /usr/local/lib/python2.7/dist-packages (from requests) (2018.1.18)
Requirement not upgraded as not directly required: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/dist-packages (from requests) (3.0.4)
Requirement not upgraded as not directly required: urllib3<1.24,>=1.21.1 in /usr/local/lib/python2.7/dist-packages (from requests) (1.22)
fabdocker 0.3.5 has requirement Fabric==1.10.1, but you’ll have fabric 1.14.0 which is incompatible.
loom 0.0.18 has requirement fabric==1.6.1, but you’ll have fabric 1.14.0 which is incompatible.
fab-classic 1.15.1 has requirement paramiko<3.0,>=2.0, but you’ll have paramiko 1.18.5 which is incompatible.
cheffab 0.0.2 has requirement Fabric==1.6.0, but you’ll have fabric 1.14.0 which is incompatible.
cheffab 0.0.2 has requirement requests==1.2.0, but you’ll have requests 2.19.1 which is incompatible.
oslo-serialization 2.27.0 has requirement pbr!=2.1.0,>=2.0.0, but you’ll have pbr 1.10.0 which is incompatible.
oslo-i18n 3.21.0 has requirement pbr!=2.1.0,>=2.0.0, but you’ll have pbr 1.10.0 which is incompatible.
debtcollector 1.20.0 has requirement pbr!=2.1.0,>=2.0.0, but you’ll have pbr 1.10.0 which is incompatible.
pyasn1-modules 0.2.2 has requirement pyasn1<0.5.0,>=0.4.1, but you’ll have pyasn1 0.1.7 which is incompatible.
oslo-utils 3.36.4 has requirement pbr!=2.1.0,>=2.0.0, but you’ll have pbr 1.10.0 which is incompatible.
fabric-remote 0.0.2 has requirement Fabric==1.8.1, but you’ll have fabric 1.14.0 which is incompatible.
stevedore 1.29.0 has requirement pbr!=2.1.0,>=2.0.0, but you’ll have pbr 1.10.0 which is incompatible.
deploytool 1.3 has requirement Fabric==1.13.2, but you’ll have fabric 1.14.0 which is incompatible.
fabric-bolt 0.1 has requirement fabric<1.11,>=1.10.2, but you’ll have fabric 1.14.0 which is incompatible.
fabric-bolt 0.1 has requirement requests<2.8,>=2.7.0, but you’ll have requests 2.19.1 which is incompatible.
automation 0.6.1 has requirement Fabric==1.7.0, but you’ll have fabric 1.14.0 which is incompatible.
fabric2 2.2.1 has requirement paramiko>=2.4, but you’ll have paramiko 1.18.5 which is incompatible.
Cheers,
A. Yasir