I am stuck at one point in my salt custom module creation. I am running the below salt version of master and minion on my vm's, and I am trying to call the get_user function to find the owner of the file using the path. The path exists but salt responds with an error message:
saltuser#vmSaltMaster:/$ sudo salt '*' file.get_user /etc/passwd
[sudo] password for saltuser:
172.18.1.7:
'file.get_user' is not available.
saltuser#vmSaltMaster:/$ salt '*' --versions-report
Salt: 2015.5.3
Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
Jinja2: 2.7.2
M2Crypto: 0.21.1
msgpack-python: 0.3.0
msgpack-pure: Not Installed
pycrypto: 2.6.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 14.0.1
RAET: Not Installed
ZMQ: 4.0.4
Mako: Not Installed
Tornado: Not Installed
Debian source package: 2015.5.3+ds-1trusty1
The error was that I created a custom module under /srv/salt/_module with the name as file.py and ran a sync_all salt command. salt was confused between the custom module and the original salt module which comes with the package. I deleted my custom module and it is working fine.
Related
I am using tensorflow in a python module, which is called by a c++ file. I moved to a new computer, where I installed ros again. So it works on one computer, but not on the other. There I got the following error:
UserWarning: h5py is running against HDF5 1.10.0 when it was built against 1.10.4, this may cause problems '{0}.{1}.{2}'.format(*version.hdf5_built_version_tuple)
then I did:
pip2.7 uninstall h5py
pip2.7 install h5py==1.10.4
but then I get the following error:
No handlers could be found for logger "keyring.backend"
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
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement h5py==1.10.4 (from versions: 2.2.1, 2.3.0b1, 2.3.0, 2.3.1, 2.4.0b1, 2.4.0, 2.5.0, 2.6.0, 2.7.0rc2, 2.7.0, 2.7.1, 2.8.0rc1, 2.8.0, 2.9.0rc1, 2.9.0, 2.10.0)
ERROR: No matching distribution found for h5py==1.10.4
It seems like there is no 1.10.4 version. What should I do?
I have to use python2.7. Also if I just let the python2.7 script run, it works. Only in conjunction with ros I get this error. But I think I take the python version from the same folder.
Thank you
I know that many have posted similar question however I tried most solution without success.
I'm trying to host a webpage with apache2 and django in python3.
In the error log I found ImportError: No module named 'django' when accessing the wsgi.pyfile, where I also added import sys, sys.version to confirm which python version is used and from the error log I can see that I'm running following python version 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609].
When I run python3.5 I see that I uses the same python version and here I can run import django without any error!
EDIT: I checked django.__file__and saw that it was located in /home/USERNAME/.local/lib/python3.5/site-packages/django/init.py and that path /home/USERNAME/.local/lib/python3.5/site-packages wasn't in the sys.path that tried to run django. But adding it with sys.path.append(path) didn't help :(
Any thoughts what I might have messed up?
If you have Setup the whole configuration in VirtualEnv then , i suggest you to activate it by,
source /location to /env/bin activate
pip3 install django=version_id
or pip install django=version id
if you want to pass version id then its good or it will install the latest django from your repo.
Now test Django Version there.
Hope you will no get the error.
Location - means the path where env will be located in project directory, if you have followed the standard installation process of django or else you don't need, and version id- vesion of django framework.
I finally understood how to solve it! first I had to run pip3 uninstall django then run sudo pip3 install django.
Goal: Have python 2.7.14 and python 3.6 on my RHEL server and use pip2/pip3 to manage both.
Note: Although this server lacks an internet connection, I can download them separately and upload them to this server.
I recently installed RHEL 7.2 on a VM, this installs python 2.7.5 by default.
I decided upgrade this by doing a parallel install of 2.7.14 (using make altinstall method and keeping the existing 2.7.5 intact). Also installed python 3.6 as I plan to port all my existing python code to it in the future.
The problem arises when I try to install pip for the Python 2.7.14 or any libraries (as you will see in a little bit).
I first did a easy_install of pip:
[root#VMW01 bin]# easy_install pip
Searching for pip
Best match: pip 9.0.1
Adding pip 9.0.1 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip3 script to /usr/local/bin
Installing pip3.5 script to /usr/local/bin
Using /usr/local/lib/python3.6/site-packages
Processing dependencies for pip
Finished processing dependencies for pip
This installs pip for python 2.7.5 and 3.6 but not for python 2.7.14.
Next, I downloaded the get-pip.py:
This gets installed fine for python 2.7.5 but not for python 2.7.14:
[root#VMW01 pshah]# python get-pip.py
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 978kB/s
Collecting wheel
Downloading wheel-0.30.0-py2.py3-none-any.whl (49kB)
100% |████████████████████████████████| 51kB 9.2MB/s
Installing collected packages: pip, wheel
Successfully installed pip-9.0.1 wheel-0.30.0
[root#VMW01 pshah]# /usr/local/bin/python2.7 get-pip.py
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting pip
Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
Could not find a version that satisfies the requirement pip (from versions: )
No matching distribution found for pip
This seems like a lack of a SSL libray.
First, I did install this using yum:
[root#VMW01 pshah]# yum install openssl
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Package 1:openssl-1.0.1e-42.el7_1.9.x86_64 already installed and latest version
Nothing to do
[root#VMW01 pshah]# yum install openssl-devel
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Package 1:openssl-devel-1.0.1e-42.el7_1.9.x86_64 already installed and latest version
Nothing to do
Second, this seems to be present for python 2.7.5
[root#VMW01 pshah]# python
Python 2.7.5 (default, Oct 11 2015, 17:47:16)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>>
Am I overarching too much? Should I settle with the default installation of 2.7.5 and python 3.6?
I know virtualenv might be a solution here, but i'm not sure how I can make it work with Apache executing python scripts.
Thanks.
As it mentions here: https://pip.pypa.io/en/latest/installing I did a local install of pip but called the python executable for python 2.7.14.
Downloaded the .whl files for wheel, setuptools and pip and then ran the below:
[root#VMW01 pshah]# /usr/local/bin/python2.7 get-pip.py --no-index --find-link=.
Collecting pip
Collecting setuptools
Collecting wheel
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-9.0.1 setuptools-36.5.0 wheel-0.30.0
I believe calling pip2.7 will install packages for the python 2.7.14 now.
Tested this by installing the xlrd library (Note - I had the xlrd tarball in the local directory):
[root#VMW01 pshah]# pip2.7 install xlrd-1.1.0.tar.gz
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Processing ./xlrd-1.1.0.tar.gz
Building wheels for collected packages: xlrd
Running setup.py bdist_wheel for xlrd ... done
Stored in directory: /root/.cache/pip/wheels/b9/dc/43/e6acfa12bc48cdf3654dd7f44c66880548ea0322324bc6095f
Successfully built xlrd
Installing collected packages: xlrd
Successfully installed xlrd-1.1.0
[root#VMW01 pshah]# /usr/local/bin/python2.7
Python 2.7.14 (default, Oct 6 2017, 18:31:52)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xlrd
>>>
I am trying to install cassandra version 2.2.0 and I found the compatible python version for it is 2.7.10 then I installed it.
when I type in terminal
python2.7 --version
Python 2.7.10
but when I launch cassandra server and want to start cassandra query language shell by typing
root#eman:/usr/local/cassandra# bin/cqlsh
bin/cqlsh: 19: bin/cqlsh: python: not found
how could I fix this issue
thanks in advance
For centos 8 and other similarly:
Install python 2.7
Then, prior to invoking cqlsh, run:
sudo alternatives --set python /usr/bin/python2
It seems that python is not installed on your machine (for whatever reason).
cqlsh shells out to python (in a rather strange way): https://github.com/spiside/cqlsh/blob/6f5b680fed2e48e37107fd1da272e351e5ac257d/cqlsh#L1-L30
Unrelated to this stackoverflow issue, I attempted to fix (and probably fixed) this in the latest version of cqlsh: https://github.com/spiside/cqlsh/commit/a880445ec9d05cfa552928d5a88d1457640456b6
If you can upgrade cqlsh it may fix this.
If you can't upgrade cqlsh any of the following things should fix this:
- If you're on an debian-like system apt-get install python-minimal -- this provides the /usr/bin/python file that seems to be missing (for whatever reason)
- If your package manager has a package which provides the /usr/bin/python symlink, install that
- Otherwise, set up a symlink that's on your path, for example ln -sf /usr/bin/python2.7 /usr/local/bin/python
I cannot find a good source of information on how to upgrade Django to 1.4 on TurnKey Django (based on Ubuntu 10.04). I did not worked at Unix machine for a long time and I am a bit lost. Some IRC channel?
The best way to do this is to install django 1.4 in a virtual environment.
First, install virtualenv (if its not installed already sudo apt-get install python-virtualenv)
Then, install django 1.4:
$ virtualenv --no-site-packages django_1_4
$ source django_1_4/bin/activate
(django_1_4) $ pip install django
(django_1_4) $ python
Python 2.7.3 (default, Apr 20 2012, 22:44:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.get_version()
'1.4'
After your comment, I have another suggestion. Since this is a single purpose machine, you can simply upgrade the global version of django on your machine.
First, to avoid conflicts, uninstall django if it was installed from apt:
apt-get remove --purge python-django
Then, since you already installed python-virtualenv from above, you can do this:
$ sudo pip install -U django
This will upgrade (or install) django to the latest version available to the global site packages directory.
Then you can do the same import django and then django.get_version() and it should return 1.4.
While I am having a hard time finding an official source with version information, it seems to me that the latest Django release for TurnKey Linux is (as of Dec. 2011) at most version 1.3.1.
Check out this mail archive question and click through the threads for more information. They discuss setting up the latest version of Django for TurnKey Linux using tools such as virtualenv to ensure that you are able to continue to use older (outdated) packages if need be.