Shiva Gupta
Shiva Gupta

Reputation: 402

Error installing pydns

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.

Upvotes: 10

Views: 12952

Answers (3)

A.HEDDAR
A.HEDDAR

Reputation: 307

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

Upvotes: 1

Shivam Kohli
Shivam Kohli

Reputation: 489

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

Upvotes: 23

valentin
valentin

Reputation: 3608

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

Upvotes: 3

Related Questions