I'm trying to configure 2 Ubuntu servers to use Python and Tensorflow for my project. I finished the 1st server, however, there are some very unusual and annoying errors with the 2nd one. This is the log when I run pip check on the 1st server:
~$: pip check
No broken requirements found.
And the error log on the 2nd one:
~$: pip check
No broken requirements found.
Traceback (most recent call last):
File "/home/mju-hpc-02/.local/bin/pip", line 11, in <module>
sys.exit(main())
File "/home/mju-hpc-02/.local/lib/python3.5/site-
packages/pip/__init__.py", line 233, in main
return command.main(cmd_args)
File "/home/mju-hpc-02/.local/lib/python3.5/site-
packages/pip/basecommand.py", line 251, in main
timeout=min(5, options.timeout)) as session:
File "/home/mju-hpc-02/.local/lib/python3.5/site-
packages/pip/basecommand.py", line 72, in _build_session
insecure_hosts=options.trusted_hosts,
File "/home/mju-hpc-02/.local/lib/python3.5/site-
packages/pip/download.py", line 329, in __init__
self.headers["User-Agent"] = user_agent()
File "/home/mju-hpc-02/.local/lib/python3.5/site-
packages/pip/download.py", line 93, in user_agent
from pip._vendor import distro
File "/home/mju-hpc-02/.local/lib/python3.5/site-
packages/pip/_vendor/distro.py", line 1050, in <module>
_distro = LinuxDistribution()
File "/home/mju-hpc-02/.local/lib/python3.5/site-
packages/pip/_vendor/distro.py", line 594, in __init__
if include_lsb else {}
File "/home/mju-hpc-02/.local/lib/python3.5/site-
packages/pip/_vendor/distro.py", line 931, in _get_lsb_release_info
raise subprocess.CalledProcessError(code, cmd, stdout, stderr)
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero
exit status 1
This error also shows everytime I'm trying to install a new package with pip. Anyone faced similar problems with pip or having a way to diagnose the error?
EDIT 1:
As languitar suggestion, I ran lsb_release -a on both machines and this is the log on the 1st one:
~$: lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
2nd one:
~$: lsb_release -a
Traceback (most recent call last):
File "/usr/bin/lsb_release", line 25, in <module>
import lsb_release
ImportError: No module named 'lsb_release'
You did not mention your Python version(s) available on your system.
Not sure how this happen, but often 'lsb_version' is available to run on python v2 and others on v3.
Most likely you have a multiple python version on your host.
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero
exit status 1
Is, indeed, failing because the 'lsb_release' library called by '/usr/bin/lsb_release' is not available for your particular Python version.
Your first attempt to fix this is simple:
sudo apt install lsb-release
Note is '-' and not '_'
Try again, if keep failing try the following: Look for your Python version library on /usr/lib, and confirm that 'lsb_release.py' is not there. Then, link the shared version to your library:
ln -sfv /usr/share/pyshared/lsb_release.py /usr/lib/python3.7/site-packages/lsb_release.py
Last resource, search /usr for any lsb_release.py and link it to your Python library.
find /usr -name lsb_release.py
You can just use default lsb_release or perhaps a bit modified version:
1 #!/bin/bash
171 [ -z "$LSB_VERSION" ] && LSB_VERSION="1.4"
172 #$MSG_NA
It seems your lsb_release binary is broken. Try to reinstall lsb-release (ubuntu or debian package).
Related
I am currently trying to do a simple git commit -m "first commit" but it is not working
whenever i run this command:
git commit -m "first commit"
I get this error:
env: python3.7: Not a directory
My first attempt was to do brew upgrade python
This pointed python3 to python#3.8.
I ran the git command again but I am still have the same issue.
if i have upgraded to python3.8 why is my terminal still giving me the error:
env: python3.7: Not a directory
My second attempt was to check the environment variable by running the env command
but i do not see any environment variable set to python3.7
After reading python location on mac osx
My third attempt was to create a symbol link to python3.7.
so i did
ln -s /usr/local/Cellar/python/3.7.7/bin/python3.7 /usr/local/bin/python3.7
ln -s /usr/local/Cellar/python/3.7.7/bin/python3.7-config /usr/local/bin/python3.7-config
After this i tested by running a git commit command. The result was
Traceback (most recent call last):
File ".git/hooks/pre-commit", line 44, in <module>
os.execvp(CMD[0], CMD)
File "/usr/local/Cellar/python/3.7.7/bin/../Frameworks/Python.framework/Versions/3.7/lib/python3.7/os.py", line 574, in execvp
_execvpe(file, args)
File "/usr/local/Cellar/python/3.7.7/bin/../Frameworks/Python.framework/Versions/3.7/lib/python3.7/os.py", line 616, in _execvpe
raise last_exc
File "/usr/local/Cellar/python/3.7.7/bin/../Frameworks/Python.framework/Versions/3.7/lib/python3.7/os.py", line 607, in _execvpe
exec_func(fullname, *argrest)
NotADirectoryError: [Errno 20] Not a directory
Please can you help me to resolve this problem.
Thank you
Traceback (most recent call last):
File ".git/hooks/pre-commit", line 44, in <module>
You've installed a bad pre-commit hook.
I want to install Anaconda on my mac (version 10.9.5).
The command I used:
sh Anaconda3-2020.02-MacOSX-x86_64.sh
Led to this error:
Unpacking payload ...
Traceback (most recent call last):
File "entry_point.py", line 69, in <module>
File "concurrent/futures/process.py", line 483, in _chain_from_iterable_of_lists
File "concurrent/futures/_base.py", line 598, in result_iterator
File "concurrent/futures/_base.py", line 435, in result
File "concurrent/futures/_base.py", line 384, in __get_result
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
[1061] Failed to execute script entry_point
After rooting around, I found this suggestion, that I check the hash.
I typed this:
shasum -a 512 /Users/Slowat/Anaconda3-2020.02-MacOSX-x86_64.sh
and the output was:
aa1ed0c40646ba9041abf59c13ce38da1dc51bf15de239b6f966a0b02b4c09c960ae33698c72aa46db41731f8e67938d1972fcb76fa4c5c8081bc0272bb1b535 /Users/Slowat/Anaconda3-2020.02-MacOSX-x86_64.sh
The hash listed here does not match this.
So then I thought it was an issue with downloaded, so i deleted the bash script and the directory that anaconda attempted to make during the failed installation.
I double checked my python version:
localhost:~ Slowat$ python --version
Python 3.7.4
and re-downloaded Anaconda3-2020.02-MacOSX-x86_64.sh from here.
I re-checked the hash:
aa1ed0c40646ba9041abf59c13ce38da1dc51bf15de239b6f966a0b02b4c09c960ae33698c72aa46db41731f8e67938d1972fcb76fa4c5c8081bc0272bb1b535 /Users/Slowat/Anaconda3-2020.02-MacOSX-x86_64.sh
and it's still wrong. Any ideas what I'm doing wrong here (mainly for the original area, checking the hash was just an idea I had).
As marhil95 mentioned in a GitHub issue, you can also get this error if you run out of disk space.
I have discovered that conda cannot be run on mac v. 10.9.5; i first updated the mac to 10.11, and then from 10.11 to 10.13 (you have to do it in those two steps). Then conda installed and ran fine.
I'm trying to load test my MQTT network on a CentOS7 machine by using this repositorie on github. I executed the following commands to install the python-mosquitto dependency.
# yum install python-pip
# pip install mosquitto
Then I built and installed the setup.py file located in the repository file:
# python setup.py build
# python setup.py install
When trying to use the package, an error was thrown:
# malaria publish -P 2 -n 100 -H localhost -s 10
Error:
# malaria publish -P 2 -n 100 -H localhost -s 10malaria publish -P 2 -n 100 -H localhost -s 10
Traceback (most recent call last):
File "/usr/bin/malaria", line 5, in <module>
pkg_resources.run_script('mqtt-malaria==0.1-77-g7ae4c97', 'malaria')
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 540, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1455, in run_script
execfile(script_filename, namespace, namespace)
File "/usr/lib/python2.7/site-packages/mqtt_malaria-0.1_77_g7ae4c97-py2.7.egg/EGG-INFO/scripts/malaria", line 30, in <module>
import beem.main
File "/usr/lib/python2.7/site-packages/mqtt_malaria-0.1_77_g7ae4c97-py2.7.egg/beem/main.py", line 34, in <module>
import beem.cmds
File "/usr/lib/python2.7/site-packages/mqtt_malaria-0.1_77_g7ae4c97-py2.7.egg/beem/cmds/__init__.py", line 2, in <module>
import beem.cmds.subscribe
File "/usr/lib/python2.7/site-packages/mqtt_malaria-0.1_77_g7ae4c97-py2.7.egg/beem/cmds/subscribe.py", line 34, in <module>
import beem.listen
File "/usr/lib/python2.7/site-packages/mqtt_malaria-0.1_77_g7ae4c97-py2.7.egg/beem/listen.py", line 40, in <module>
import fuse
File "build/bdist.linux-x86_64/egg/fuse.py", line 69, in <module>
EnvironmentError: Unable to find libfuse
Googling the error didn't provide me any answers. Did I do something wrong in the install process? I don't have much experience with the usage/building of cloned Github Repositories.
If running CentOS you may want to do "yum install fuse-python", which will install fuse-libs as dependencies. It worked for me after doing that.
The issues page on the repository (the issue right before the one you linked to) mentions exactly this problem.
The solution, as you've found is to install fusepy separately, either from your package manager or with pip install fusepy.
I am attempting to install the openstack nova client on my Mac (10.4.8)
nova = https://github.com/openstack/python-novaclient#command-line-api
python --version
Python 2.7.2
I successfully got nova installed (after installing pip)
When I run the client, I get the following error
foo#bar-macbook-pro:~$ nova
Traceback (most recent call last):
File "/usr/local/bin/nova", line 6, in <module>
from novaclient.shell import main
File "/Library/Python/2.7/site-packages/novaclient/__init__.py", line 15, in <module>
import pbr.version
ImportError: No module named pbr.version
In my research, I have found conflicting information about pbr, some say it is required for nova, while others say it isn't required for nova.
https://github.com/rackspace/pyrax/issues/121
When I attempt to install pbr, I see the following error.
foo#bar-macbook-pro:~$ sudo python ~/Downloads/pbr/setup.py install
Traceback (most recent call last):
File "setup.py", line 22, in <module>
**util.cfg_to_args())
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/util.py", line 241, in cfg_to_args
pbr.hooks.setup_hook(config)
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/hooks/__init__.py", line 27, in setup_hook
metadata_config.run()
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/hooks/base.py", line 29, in run
self.hook()
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/hooks/metadata.py", line 28, in hook
self.config['name'], self.config.get('version', None))
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/packaging.py", line 817, in get_version
version = _get_version_from_git(pre_version)
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/packaging.py", line 776, in _get_version_from_git
"git --git-dir=\"" + git_dir + "\" describe --always").replace(
File "/Volumes/WDBlack750/spencerowen/Downloads/pbr/pbr/packaging.py", line 220, in _run_shell_command
stderr=err_location)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1228, in _execute_child
raise child_exception
TypeError: must be encoded string without NULL bytes, not str
Is there anything apparent that would explain why I can not get the library installed?
Surely I must not be the first person to try and install nova on OS X.
Over a year later, I finally got this working on OS X Yosemite
sudo pip install python-novaclient
I did not have to install pbr.
I did the install based on venv:
virtualenv venv_name
source venv_name/bin/activate
pip install python-novaclient fabric
In my case, I had a mixup in which python I was using by way of fabric being installed globally.
Prior: rf -rf all my virtualenvs, rf -rf all references to novaclient (locally, and globally), and deleted a global install of fabric which was calling the novaclient.
Also as a precaution, I do not install pip globally, and only use it without sudo in virtualenvs.
I have 64-bit Python (2.7.5) installed at C:\Python27 and 32-bit Python at C:\Python27_32.
I would like to use virtualenv to set up a 32-bit virtual environment that I can switch into when I need to use 32-bit Python. Once that environment is set up, I plan to edit the bin\activate file to change all the necessary paths to point to the 32-bit directories.
However, when I try to create the virtual environment, I get the following error:
> virtualenv --python=C:\Python27_32\python.exe foo
Running virtualenv with interpreter C:\Python27_32\python.exe
PYTHONHOME is set. You *must* activate the virtualenv before using it
New python executable in foo\Scripts\python.exe
Installing setuptools...............
Complete output from command C:\Users\<user>\Drop...o\Scripts\python.exe -c "#!python
\"\"\"Bootstra...sys.argv[1:])
" C:\Python27\lib\site...ols-0.6c11-py2.7.egg:
Traceback (most recent call last):
File "<string>", line 278, in <module>
File "<string>", line 238, in main
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 21, in <module>
File "build/bdist.linux-i686/egg/setuptools/package_index.py", line 2, in <module>
File "C:\Python27\Lib\urllib2.py", line 94, in <module>
import httplib
File "C:\Python27\Lib\httplib.py", line 71, in <module>
import socket
File "C:\Python27\Lib\socket.py", line 47, in <module>
import _socket
ImportError: DLL load failed: %1 is not a valid Win32 application.
----------------------------------------
...Installing setuptools...done.
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\virtualenv.py", line 2577, in <module>
main()
File "C:\Python27\lib\site-packages\virtualenv.py", line 979, in main
no_pip=options.no_pip)
File "C:\Python27\lib\site-packages\virtualenv.py", line 1091, in create_environment
search_dirs=search_dirs, never_download=never_download)
File "C:\Python27\lib\site-packages\virtualenv.py", line 611, in install_setuptools
search_dirs=search_dirs, never_download=never_download)
File "C:\Python27\lib\site-packages\virtualenv.py", line 583, in _install_req
cwd=cwd)
File "C:\Python27\lib\site-packages\virtualenv.py", line 1057, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command C:\Users\<user>\Drop...o\Scripts\python.exe -c "#!python
\"\"\"Bootstra...sys.argv[1:])
" C:\Python27\lib\site...ols-0.6c11-py2.7.egg failed with error code 1
It seems to be doing imports in the 64-bit folder instead of in the 32-bit folder. I'm not sure if it's because of the way my environment variables are set up, or because I installed virtualenv under 64-bit Python in the first place.
These are my user environment variables:
Path: %PYTHONHOME%;C:\Python27\Scripts
PYTHONHOME: C:\Python27
PYTHONPATH: C:\Python27\Lib;C:\Python27\Lib\lib-tk;C:\Python27\DLLs;
But if I change every C:\Python27 to C:\Python27_32 in my environment variables, then I can't virtualenv to run (ImportError: No module named pkg_resources).
This is my first time messing with virtualenv, so I'm sure I'm missing something basic. How can I create a virtual environment that uses my 32-bit Python installation?
For your virtual env to run after you have changed your paths you will need to install virtualenv into the 32 bit python - there is nothing stopping you having a copy of virtualenv in each python.
Assuming you have python 2.7.c 64-bit as your default python and you have also installed python 2.7.x 32-bit you would need both anyway - also assuming that you are on windows your two pythons will be installed somewhere like:
C:\Python27 and C:\Python27_64
With the latter on your path.
Also assuming that you have pip installed in both, you will need it for virtualenv anyway - to install virtualenv to the 32 bit python you can either run:
Path\To\32Bit\pip install virtualenv
or
set path=C:\Python27;C:\Python27\Scripts;%path%
rem The above should set your 32 bit to be found before your 64 bit
pip install virtualenv
If you installed the 32Bit version first, and install the 64Bit version second (And you added python to path), Then you can use the updated python launcher (py) to create the 64Bit version of your virtualenv
py -m venv my-env-name
in command prompt Use:
set CONDA_FORCE_32BIT=1
conda create -n virtualenv_name python=x.x anaconda
The above can be found # How to install win-32 package on a 64-bit system with conda install I personally tried it and it worked successfully (32-bit python x.x installed). Using Anaconda is not necessary but it will install all of the anaconda packages like pandas.
Disclaimer: The comment below is a caution and not an attack on the answer submitted by anyone else.
As my friend told me "changing the path manually is discouraged, mostly because you'd have to inform other applications that use Python (and that you do not necessarily know of) to point to a different folder, and changes are not certain to be consistent across your system. In a way, virtualenvs do the same but in a cleaner and (sort of) predictable fashion".