Error installing pydns - python

While trying to install pydns module i am getting this error:
C:\Windows\system32>pip install pydns
Collecting pydns
Using cached pydns-2.3.6.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Shiva\AppData\Local\Temp\pip-build-294324_x\pydns\setup.py", line 12, in <module>
import DNS
File "C:\Users\Shiva\AppData\Local\Temp\pip-build-294324_x\pydns\DNS\__init__.py", line 14, in <module>
import Type,Opcode,Status,Class
ImportError: No module named 'Type'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Shiva\AppData\Local\Temp\pip-build-294324_x\pydns\
I tried pip install py3dns as well but it doesn't work.

You are using the wrong version of python. pydns is not supported for python 3. pydns works for python2.7
For python3 use pip3 install py3DNS

The pydns is not supported with Python 3. You need to use python 2.7 to work with it.

It seem that there is a conflict between pyDNS and dnspython built-in package :
** / ! \ To run this solution for python3 please replace pyDNS by py3DNS**
Step 1 remove dnspython :
$ pip uninstall dnspython
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Found existing installation: dnspython 1.15.0
Uninstalling dnspython-1.15.0:
Would remove:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/*
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dnspython-1.15.0.dist-info/*
Would not remove (might be manually added):
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Base.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Base.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Class.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Class.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Lib.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Lib.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Opcode.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Opcode.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Status.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Status.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Type.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Type.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/lazy.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/lazy.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/win32dns.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/win32dns.pyo
Proceed (y/n)? y
Successfully uninstalled dnspython-1.15.0
Step 2 remove pyDNS :
$ pip uninstall pydns
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Found existing installation: pydns 2.3.6
Uninstalling pydns-2.3.6:
Would remove:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Base.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Base.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Class.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Class.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Lib.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Lib.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Status.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Status.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Type.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Type.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/lazy.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/lazy.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/win32dns.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/win32dns.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydns-2.3.6.dist-info/*
Proceed (y/n)? y
Successfully uninstalled pydns-2.3.6`
### Step 2 Install pyDNS again :
`$ pip install pydns
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Processing /Library/Caches/pip/wheels/54/c3/70/622b2f4958520225fab47eceb1e2659ac4d03ec6760ec26024/pydns-2.3.6-py2-none-any.whl
Installing collected packages: pydns
Successfully installed pydns-2.3.6
Step 3 Check the installed package with :
$ python -m DNS
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named DNS.__main__; 'DNS' is a package and cannot be directly executed
Enjoy

Related

How to install Tensorflow==1.X.X for Python2.7 on Ubuntu?

I try to install tensorflow==1.1.0 for Python2.7 with pip package manager but am getting the following error when I run the command pip install tensorflow:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at pip.pypa.io/en/latest/development/release-process/… pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement tensorflow==1.1.0 (from versions: none)
ERROR: No matching distribution found for tensorflow==1.1.0
How else can I install tensorflow for Python2.7?
Thank you!
You could use a ready to use Docker image.
https://hub.docker.com/r/tensorflow/tensorflow/tags?page=1&name=1.1.0
The tags with the postfix ”py3“ indicate using Python 3.x while the ones without this postfix are using Python 2.7.
Here some additional information about the Docker images. https://hub.docker.com/r/tensorflow/tensorflow/
Dockerfiles for TF 1.1.0 https://github.com/tensorflow/tensorflow/tree/v1.1.0/tensorflow/tools/docker

Can't install pyinstaller on python 2

pip2 install pyinstaller
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting pyinstaller
Using cached pyinstaller-4.1.tar.gz (3.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python2 /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpXfz8sO
cwd: /tmp/pip-install-VoIwF7/pyinstaller
Complete output (4 lines):
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 16, in <module>
from importlib import import_module
ImportError: No module named importlib
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python2 /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpXfz8sO Check the logs for full command output.
on both windows and linux unable to install pyinstaller on python 2. Say similar error. I need to compile a code written on python 2. Any body occur same error? Please help
The latest version of pyinstaller does not support Python 2.7, as described under Requirements.
For Python 2.7 to work, you must install version 3.6.
First of all, you should upgrade your python version and here you are importing the package that is not installed so install first using pip install importlib

Do I need a 'requirements.txt' file or should I install dependencies? Azure DevOps

So I'm in the process of playing around with SonarCloud/SonarLint and had to set up some preliminaries - i.e. create AzureDevOps and Pipeline. This is my first time diving into Azure and I honestly don't understand how to go about fixing this error. I'm assuming I either need to create a 'requirements.txt' file or that I need to install dependencies....or both. Either way,I honestly don't know where to get started with this. Could someone please help? Below is the log I get from testing out the pipeline which is where my issue lies. Am I right in my assumption? Thanks in advance!
2020-12-20T01:30:10.5970195Z ##[section]Starting: Install dependencies
2020-12-20T01:30:10.5977975Z ==============================================================================
2020-12-20T01:30:10.5978665Z Task : Command line
2020-12-20T01:30:10.5978936Z Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2020-12-20T01:30:10.5979213Z Version : 2.178.0
2020-12-20T01:30:10.5979420Z Author : Microsoft Corporation
2020-12-20T01:30:10.5979702Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2020-12-20T01:30:10.5980019Z ==============================================================================
2020-12-20T01:30:11.0224446Z Generating script.
2020-12-20T01:30:11.0226001Z ========================== Starting Command Output ===========================
2020-12-20T01:30:11.0229091Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/f501a929-0e67-45b9-9e28-7047fe9295cf.sh
2020-12-20T01:30:15.1478266Z DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
2020-12-20T01:30:15.8292586Z Collecting pip
2020-12-20T01:30:15.8700890Z Downloading pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
2020-12-20T01:30:15.9513160Z Installing collected packages: pip
2020-12-20T01:30:15.9513725Z Attempting uninstall: pip
2020-12-20T01:30:15.9514085Z Found existing installation: pip 20.3.1
2020-12-20T01:30:16.0461039Z Uninstalling pip-20.3.1:
2020-12-20T01:30:16.0935089Z Successfully uninstalled pip-20.3.1
2020-12-20T01:30:16.9255324Z Successfully installed pip-20.3.3
2020-12-20T01:30:17.4315243Z DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
2020-12-20T01:30:17.5185497Z ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
2020-12-20T01:30:17.5845613Z ##[error]Bash exited with code '1'.
2020-12-20T01:30:17.5859482Z ##[section]Finishing: Install dependencies
I would highly recommend to go through the official documentation on Use CI/CD to deploy a Python web app to Azure App Service
Irrespective of Azure Devops, you need to have the dependencies define in requirements.txt and bound your dependencies to the respective environment. With Azure Devops, you need to define a task to install the dependencies from file which is defined here.
steps:
- task: UsePythonVersion#0
inputs:
versionSpec: '$(pythonVersion)'
displayName: 'Use Python $(pythonVersion)'
- script: |
python -m venv antenv
source antenv/bin/activate
python -m pip install --upgrade pip
pip install setup
pip install -r requirements.txt
workingDirectory: $(projectRoot)
displayName: "Install requirements"
```

Issue with Installing Pillow for Python

I am trying to install Pillow in my RedHat operating system through pip
sudo pip install Pillow
However, I receive the following error
You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting Pillow
/usr/lib/python2.6/sitepackages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading Pillow-4.2.1.tar.gz (12.7MB)
100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 12.7MB 35kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-5XOfq_/Pillow/setup.py", line 143
required = {'jpeg', 'zlib'}
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5XOfq_/Pillow
How can I address this?
Thanks
The error you're getting has to do with the new syntax for creating sets that was introduced in Python 2.7.
{item1, item2, ...}
It seems you're running a version of Python prior to 2.7, which doesn't recognize this as valid syntax.
Pillow's web site includes notes on which versions of Pillow are compatible with which versions of Python. You'll need to either upgrade Python (recommended), or choose an older version of Pillow which works with the Python version you have.
http://prodiguer.github.io/synda/faq.html#transfer-module
here says:
This bug affects 3.6 version installed from source (RPM 3.6 and DEB
3.6 should not be affected). It has been fixed in 3.7. It can be fixed in 3.6 by downgrading the pypi pillow package:
pip install pillow==3.4.2

"AssertionError: Only python 2.7 and later is supported by ptyprocess", when installing pexpect via pip on python 2.6

I got following error when trying install pexpect via pip:
# pip install pexpect
Collecting pexpect
do_ypcall: clnt_call: RPC: Unable to receive; errno = Connection refused
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Using cached pexpect-4.0.tar.gz
Collecting ptyprocess>=0.5 (from pexpect)
Using cached ptyprocess-0.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-2X4It7/ptyprocess/setup.py", line 10, in <module>
"Only python 2.7 and later is supported by ptyprocess.")
AssertionError: Only python 2.7 and later is supported by ptyprocess.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-2X4It7/ptyprocess
It's pretty clear that downloaded ptyprocess works only with python 2.7, but doesn't pip should download correct packages versions, that are compatible with installed python versions?
My system info:
pip -V: pip 7.1.2 from /usr/lib/python2.6/site-packages (python 2.6)
python -V: Python 2.6.6
OS: CentOS 6.3
BTW: yum install pexpect succesfully installs pexpect package
Thank You
yum will install pexpect v2.3.6.
easy_install or pip will install pexpect v4.0.1 as of today.
You can use pexpect version 3.3 which not depends on ptyprocess version.
# easy_install pexpect==3.3
or
# pip install pexpect==3.3
AssertionError: Only python 2.7 and later is supported by ptyprocess.
pyexpect depends on ptyprocess>=0.5 (https://github.com/pexpect/pexpect/blob/master/setup.py#L66)
You will need to install a version of ptyprocess that is >=0.5 but works with python 2.6 first, then install pyexpect.
edit looks like you are out of luck, 0.5 requires python 2.7 (https://github.com/pexpect/ptyprocess/blob/master/setup.py#L9-L10). Your system package has it patched to work with 2.6 so you'll have to use that.

Categories