Error while building ns-3 - python

I am trying to install ns-3 by tarball but when I try to build with following command
./build.py --enable-examples --enable-tests
as given in manual I get following error:
Traceback (most recent call last):
File "./build.py", line 170, in <module>
sys.exit(main(sys.argv))
File "./build.py", line 111, in main
config = dom.parse(dot_config)
File "/usr/local/lib/python2.7/xml/dom/minidom.py", line 1917, in parse
from xml.dom import expatbuilder
File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 32, in <module>
from xml.parsers import expat
File "/usr/local/lib/python2.7/xml/parsers/expat.py", line 4, in <module>
from pyexpat import *
ImportError: /usr/local/lib/python2.7/lib-dynload/pyexpat.so: undefined symbol: PyUnicodeUCS2_DecodeUTF
I know this error is related to python but not able to resolve after doing a lot of Google search.Can anybody help me how to proceed further?

Solved:
After exhausted research I found Python for Linux default setting is UCS2.
I rebuilt Python from source using
./configure --enable-unicode=ucs4
to force compile using UCS4.
Here is the link.

Related

Facing error messages when importing sklearn in python i.d

I get an error when importing sklearn in python 3.9.
I am using I.D.L.E. in Windows.
Installed it using cmd command: pip install -U scikit-learn as given in https://scikit-learn.org/stable/install.html
The received error message is:
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
import sklearn
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\__init__.py", line 82, in <module>
from .base import clone
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\base.py", line 17, in <module>
from .utils import _IS_32BIT
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\utils\__init__.py", line 29, in <module>
from .fixes import parse_version, threadpool_info
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\utils\fixes.py", line 19, in <module>
import scipy.stats
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\stats\__init__.py", line 453, in <module>
from ._stats_py import *
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\stats\_stats_py.py", line 38, in <module>
from scipy.spatial.distance import cdist
File "C:\Users\USER\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\spatial\__init__.py", line 104, in <module>
from ._qhull import *
ImportError: DLL load failed while importing _qhull: The specified module could not be found.
Please help.
Since the required file _qhull.yp39-win_amd64.pyd is there, it must be a problem with the dependencies this DLL file has and can't find on your computer.
Use a dependency walker like this one to find out what is missing on your system and see that you get those missing pieces installed.
Quite likely you are missing some of the Microsoft Redistributable Visual Studio Files.
Apparently my scipy got corrupted somehow. Uninstalling and re-installing it fixed the problem. Thanks everyone who took their time and effort to help though.

ImportError: No module named gconf when importing dogtail

I have successfully install dogtail 0.7.1.1 on my system but when I try to
from dogtail import tree
I get this error instead
Traceback (most recent call last):
File "appstartup.py", line 9, in ?
from dogtail.procedural import *
File "/usr/lib/python2.4/site-packages/dogtail/procedural.py", line 18, in ?
import tree
File "/usr/lib/python2.4/site-packages/dogtail/tree.py", line 66, in ?
checkForA11y()
File "/usr/lib/python2.4/site-packages/dogtail/utils.py", line 185, in checkForA11y
if not isA11yEnabled(): bailBecauseA11yIsDisabled()
File "/usr/lib/python2.4/site-packages/dogtail/utils.py", line 158, in isA11yEnabled
import gconf
ImportError: No module named gconf
I have used the below command to verify that gconf is available on my system. Have anyone encountered this problem?
> gconftool-2 --version
2.16.0
pip install gconf should fix it.

ImportError: cannot import name 'tqdm' from 'conda._vendor.tqdm' (unknown location)

Hello I am using mac actually when I searched analytics in finder I removed some folders (I thought they are useless :) after that when I type conda update or such I am getting those errors and further more.
I am keeping exact error:
Traceback (most recent call last):
File "/Users/nunemunthalashiva/anaconda3/bin/conda", line 13, in <module>
sys.exit(main())
File "/Users/nunemunthalashiva/anaconda3/lib/python3.8/site-packages/conda/cli/main.py", line 151, in main
from ..exceptions import conda_exception_handler
File "/Users/nunemunthalashiva/anaconda3/lib/python3.8/site-packages/conda/exceptions.py", line 25, in <module>
from .common.io import dashlist, timeout
File "/Users/nunemunthalashiva/anaconda3/lib/python3.8/site-packages/conda/common/io.py", line 33, in <module>
from .._vendor.tqdm import tqdm
ImportError: cannot import name 'tqdm' from 'conda._vendor.tqdm' (unknown location)
Python comes with some libraries that are required to preform some basic operation later in python such as update or install libraries. I think you removed those python libraries that are required to update/used in other ....to remove these error you have to add/restore those libraries or reinstall python.

Scrapy - Error while creating project - DDL Load failed

I am trying for a longer time.Please do help.
I installed scrapy using conda.
I tested pip show scrapy in the command line and it is working perfectly.
While i type import scrapy in the python terminal it is not showing any error.
But if i create a project or execute an existing project of scrapy i get the following error:
C:\Users\Nikeshh\Anaconda2\lib\site-packages\scrapy\commands\deploy.py:16: ScrapyDeprecationWarning: Module `scrapy.command` is deprecated, use `scrapy.commands` instead
from scrapy.command import ScrapyCommand
Traceback (most recent call last):
File "C:\Users\Nikeshh\Anaconda2\Scripts\scrapy-script.py", line 10, in <module>
sys.exit(execute())
File "C:\Users\Nikeshh\Anaconda2\lib\site-packages\scrapy\cmdline.py", line 149, in execute
cmd.crawler_process = CrawlerProcess(settings)
File "C:\Users\Nikeshh\Anaconda2\lib\site-packages\scrapy\crawler.py", line 252, in __init__
log_scrapy_info(self.settings)
File "C:\Users\Nikeshh\Anaconda2\lib\site-packages\scrapy\utils\log.py", line 149, in log_scrapy_info
for name, version in scrapy_components_versions()
File "C:\Users\Nikeshh\Anaconda2\lib\site-packages\scrapy\utils\versions.py", line 35, in scrapy_components_versions
("pyOpenSSL", _get_openssl_version()),
File "C:\Users\Nikeshh\Anaconda2\lib\site-packages\scrapy\utils\versions.py", line 43, in _get_openssl_version
import OpenSSL
File "C:\Users\Nikeshh\Anaconda2\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "C:\Users\Nikeshh\Anaconda2\lib\site-packages\OpenSSL\crypto.py", line 16, in <module>
from OpenSSL._util import (
File "C:\Users\Nikeshh\Anaconda2\lib\site-packages\OpenSSL\_util.py", line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File "C:\Users\Nikeshh\Anaconda2\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 13, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: DLL load failed: The operating system cannot run %1.
I am using scrapy startproject tutorial to create a project.How to solve this error?
Is there any specific way to execute the scrapy code?
Even when i add openssl using conda i am getting the same error
It looks like you need the OpenSSL libraries that are used for encryption.
You could go and download these from somewhere here: https://wiki.openssl.org/index.php/Binaries
Alternatively I think the installer for git will install OpenSSL by default, which you can get here: https://git-scm.com/download
However, since you're using Anaconda, OpenSSL should also be available with conda: https://anaconda.org/anaconda/openssl
Hope this helps!

Permission denied module importation with Spacepy

I need Spacepy package. I installed it carefully following these instructions with no particular problem. At the end of the installation, I did:
python
>>> import spacepy
And it worked just fine. Later on I tried to run a script which uses spacepy and I got an import error with this package. Then I did:
python
>>> import spacepy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "spacepy/__init__.py", line 329, in <module>
_read_config(rcfile)
File "spacepy/__init__.py", line 297, in _read_config
_write_defaults(rcfile, defaults)
File "spacepy/__init__.py", line 200, in _write_defaults
f = open(rcfile, 'r+t') #Avoid race condition, open for read and write
IOError: [Errno 13] Permission denied: '/home/arnaud/.spacepy/spacepy.rc'
>>>
I tried:
cd ~/.spacepy
chmod +rwx spacepy.rc
But it didn't change anything. I also tried to run python with sudo, and it does not work as well, although I have a different error:
sudo python
>>> import spacepy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/spacepy/__init__.py", line 131, in <module>
from . import datamodel
File "/usr/local/lib/python2.7/dist-packages/spacepy/datamodel.py", line 178, in <module>
from . import toolbox
File "/usr/local/lib/python2.7/dist-packages/spacepy/toolbox/__init__.py", line 48, in <module>
from spacepy import time as spt
File "/usr/local/lib/python2.7/dist-packages/spacepy/time.py", line 101, in <module>
import dateutil.parser as dup
ImportError: No module named dateutil.parser
In addition, when running python with sudo, I cannot load all the other packages (numpy, scipy, etc...). I installed python 2.7 with anaconda.
Do you know something I could try ?
I did the exact same procedure on another computer and it worked with no problem.
I figured it out. Change spacepy.rc file permissions was indeed the good solution, but I did not apply it to all users with 'a' flag. Doing:
cd ~/.spacepy
chmod a+rwx spacepy.rc
Solved the problem

Categories