How to solve error: Failed to initialize NSS library? - centos7

error: Failed to initialize NSS library
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
cannot import name ts
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.7.5 (default, Nov 16 2020, 22:23:17)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
Have tried all the solutions so far available on the internet. Nothing works. Please help.

Related

What's the best way to install two versions of python

I want a easy and clean installation, in case a need to uninstall in future.
I'm running Sierra on my mac, currently I have a Anaconda 2.4 (with python 2.7) and now I need to use python 3.5 too. I looked to quite a few answers and the process seemed a little tricky to un-do if necessary.
Please, if possible, post also the uninstall process. Thanks.
Don't let the long answer intimidate you, the process can be resumed to 6 lines (really), but I tried to write the answer that I was looking for.
The option that suit me the best is virtualenv.
Installation
The simplest way is using brew:
brew install pyenv pyenv-virtualenv pyenv-virtualenvwrapper
to check the list of python versions we can use the command:
pyenv install -l
since I am interested in 3.5.1, I can easily install with the same command
pyenv install 3.5.1
Setup
Once installed, we can check the result using
$ pyenv versions
* system
3.5.1 (set by /Users/macbookpro/.pyenv/version)
this command list all versions installed, and indicates that I'm currently using system's version.
Before we change to 3.5.1 version we need to add pyenv path to .bash_profile.
In the file .bash_profile :
add the following lines. Pay attention if the PATH variable is the same in your case.
#added for pyenv
export PATH="/Users/macbookpro/.pyenv:$PATH"
eval "$(pyenv init -)"
eval "(pyenv virtualenv-init -)"
So now we have everything setup, let's test it
First, we check which version is currently in use:
$ pyenv versions
* system
3.5.1 (set by /Users/macbookpro/.pyenv/version)
Ok, now we know we have to change to 3.5.1. We can do it using:
$ pyenv global 3.5.1
$ python
Python 3.5.1 (default, Oct 20 2016, 21:43:48)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
We also verified that this is actually working. We now test the system version too.
$ pyenv global system
$ pyenv versions
* system (set by /Users/macbookpro/.pyenv/version)
3.5.1
$ python
Python 2.7.12 (default, Sep 5 2016, 20:55:16)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
Everything is working fine.
Uninstall
Simply :
$ rm -fr ~/.pyenv
And remove all the .bash_profile stuff that we added in setup.
Extras
For the Anaconda folk.
In jupyter :
In [1]: import sys
sys.version
Out [1]: '2.7.12 |Anaconda 4.1.1 (x86_64)| (default, Jul 2 2016, 17:43:17) \n[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)]'
Nothing changed.
The best way is to use virtualenv. It allows you to keep different working versions of python on the same machine without interfering with each other.
EDIT:
These are the instructions on how to install virtualenv on Mac OS.
Install the latest python version on your system:
brew install python (or python3)
Then using pip:
pip install virtualenv
Then in your home directory edit the .bashrc file. Create it if it doesn't exist. Add this line to the .bashrc file:
export PIP_REQUIRE_VIRTUALENV=true
The line above will make pip run only in virtual environment.
Apply the changes:
. .bashrc (if you in your home directory, note the dot and space before .bashrc file).
Now you should be able to use virtualenv.
If you in your project folder:
virtualenv some_venv
Then activate it:
. ./some_venv/bin/activate (note the dot).
Then you can install everything you need using pip. All the packages will go to the some_venv directory.
You want to deactivate the virtualenv, then run deactivate.
If you want to delete all the installed packages when you were under virutalenv, then just delete some_venv. That's it.
Regarding the pyenv. Honestly I have never used it. But there is an easy to follow tutorial on the github page of the project.
Hope it helps.

Not being able to run Theano on windows XP 32 with Anaconda

I’m trying to run Theano on windows XP 32 with Anaconda (Python 2.7). I installed Theano following the steps provided in the Anaconda section here: http://deeplearning.net/software/theano/install_windows.html. Everything went fine but when I try to run the script import theano I get this error message:
ImportError: DLL load failed: The specified procedure could not be found. Struggling quite a bit, could anyone please help?
I had the same issue. Now I can use Theano on Windows XP 32bits with Anaconda.
With dependency walker, we found when 'import theano', the error 'ImportError' caused by LIBSTDC++6.DLL(a g++ DLL) cannot import the non-exists symbol 'vsnprintf' in 'MSVCRT.DLL'.
The key to fix this issue is, replace the mingw installed by 'conda install mingw' (rev 4.7.0). Install mingw g++ (rev 4.9.3) with 'mingw-get-setup.exe' from sourceforge instead.
Make user you PATH environment has 'C:\MinGW\bin;C:\MinGW\lib;' (default install location) to use the correct g++.
Good luck!

no module named scipy.linalg.dsolve.umfpack

I was trying to install Dioptas using python setup_win_32.py install.
During the installation I got the following error:
no module named scipy.linalg.dsolve.umfpack
Does anyone know how I can resolve this issue?
I am running on Windows 7 (32-bit) and have installed all the following required libraries:
python 2.7
PyQt4
numpy
scipy
pyFAI
fabio
pyqtgraph
scikit-image
pyopencl
fftw3
UMFPACK wrapper has been removed from scipy starting from version 0.14.
A replacement is available as a scikit.

Testing Scipy; get "No module named msvccompiler in numpy.distutils; trying from distutils"

I'm trying to test my scipy install by installing nose and entering
import scipy
scipy.test('1','10')
I get some 200 errors but one of the more common is:
.... No module named msvccompiler in numpy.distutils; trying from distutils
Missing compiler_cxx fix for MSVCCompiler
I have MS Virtual Studio 2009 installed (required for python 2.7)
Can anyone help me eliminate that error or tell my why I can't?
Thanks
You have to do 2 things to make it find the Visual Studio Compiler:
In your environment, set VS90COMNTOOLS=%VS__vvv__COMNTOOLS% where vvv is your installed version. See other related questions on stackoverflow about setup.py and vcvarsall.bat
Run python from a Visual Studio Developer Command Prompt. VS includes a link for this in the start menu. It sets up all the environment variables you need to run the compilers and related tools from the command line.
Best solution to this could be using the Anaconda Python distribution
It has most of the engineering and data analysis packages and automatically sets path of the C++ compiler. You can easily install numpy, scipy, matplotlib etc. using Anaconda. It will not show vcvarshall.bat as well as numpy.core.multiarray error for numpy

Installing Rcpp in R 2.10 on Ubuntu

I'm trying to install Rcpp on Ubuntu 10.04 and getting this error (which implies that it doesn't exist):
> install.packages("Rcpp")
Warning in install.packages("Rcpp") :
argument 'lib' is missing: using '/home/vadmin/R/i486-pc-linux-gnu-library/2.10'
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘Rcpp’ is not available
I have a working R instance and have installed many other packages.
Edit
Now I'm getting this error when running R CMD build Rcpp on the source code off svn:
** building package indices ... Error : running Stangle on vignette
'/home/vadmin/src/R/rcpp/pkg/Rcpp/inst/doc/Rcpp-modules.Rnw'
failed with message: invalid value for
'lang' : cpp ERROR: installing package
indices failed
* removing ‘/tmp/Rinst3041838816/Rcpp’ ERROR Installation failed.
A few things:
thanks for your interest in Rcpp :-)
it has been on CRAN as Rcpp for years; if you get a Rcpp not available error then you are looking at a bad CRAN mirror and I suggest using a different one
Ubuntu also has their Rcpp version of the Rcpp Debian package so you could just do 'sudo apt-get install r-cran-rcpp' (but that may be a dated version, alas)
In general, Romain and I suggest for Rcpp questions to come to the rcpp-devel list.
I'm J.I.Perotti from Argentina. First, sorry for my english. I had the same problem as stated here. But I solve it and may be useful to others. I have Ubuntu 9.10 Karmic Koala on a Pentium Dual Core T4200 (x86_64), successfully upgraded R to the 2.12.1 version, and then successfully installed Rcpp version 0.9.0
I make a kind of logbook with the process which I wrote in my blog:
http://deliriosderayohauno.blogspot.com/2011/01/r-installation.html
I don't know so much about this page, so I hope not write this where I should not (sorry if it is the case).
Best regards
I was helped by uninstalling R, and reinstalling the developer version:
sudo apt-get install r-base-dev
Then installing Rcpp in R:
install.packages('Rcpp')