problem: I can't run "tensorboard --logdir=summaries" in my terminal because I get this error
system: macbook pro running Catalina
environment: running pyenv with python3 as global
package: I have tensorflow 2.2.0 installed via pip
I have setuptools 49.1.0
Traceback (most recent call last):
File "/usr/local/bin/tensorboard", line 10, in
sys.exit(run_main())
File "/Library/Python/3.7/site-packages/tensorboard/main.py", line 65, in run_main
default.get_plugins() + default.get_dynamic_plugins(),
File "/Library/Python/3.7/site-packages/tensorboard/default.py", line 125, in get_dynamic_plugins
"tensorboard_plugins"
File "/Library/Python/3.7/site-packages/tensorboard/default.py", line 124, in
for entry_point in pkg_resources.iter_entry_points(
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/init.py", line 2410, in load
self.require(*args, **kwargs)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/init.py", line 2433, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/init.py", line 791, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (setuptools 40.8.0 (/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages), Requirement.parse('setuptools>=41.0.0'))
the setuptools version you have is 40.8.0.
tensorboard needs setuptools>=41.0.0.
So there are two solutions:
update setuptools to >=41.0.0
create a new environment with setuptools>=41.0.0.
MacOs may not allow you to update setuptools, due to system integrity protection
Adding --user python to the command allowed this to work.
In other words
pip install --upgrade setuptools --user python
As it turns out I was not using Pyenv correctly. Once I used "pyenv global system" then I was able to update the pip packages correctly and the right setuptools was installed and TensorBoard ran as expected
Related
I'm still a novice to all the advanced parts of coding. i have the 3.9.11 version of python installed. Whenever i install Pygames, I always get this result below. Any way that i could resolve this? thanks!
C:\\Users\\username\>pip install pygame==2.0.0.dev14
Collecting pygame==2.0.0.dev14
Downloading https://files.pythonhosted.org/packages/4e/f6/9031970fbd0cabb02842a68b6bd2defc55f4c1409e76712dd32c4d6e46cf/pygame-2.0.0.dev14.tar.gz (5.6MB)
100% |################################| 5.6MB 74kB/s
c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages_distutils_hack\__init_\_.py:18: UserWarning: Distutils was imported before Setuptools, but importing Setuptools also replaces the `distutils` module in `sys.modules`. This may lead to undesirable behaviors or errors. To avoid these issues, avoid using distutils directly, ensure that setuptools is installed in the traditional way (e.g. not an editable install), and/or make sure that setuptools is always imported before distutils.
"Distutils was imported before Setuptools, but importing Setuptools "
c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages_distutils_hack\__init_\_.py:30: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
Exception:
Traceback (most recent call last):
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\basecommand.py", line 211, in main
status = self.run(options, args)
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\commands\\install.py", line 294, in run
requirement_set.prepare_files(finder)
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\req\\req_set.py", line 334, in prepare_files
functools.partial(self.\_prepare_file, finder))
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\req\\req_set.py", line 321, in \_walk_req_to_install
more_reqs = handler(req_to_install)
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\req\\req_set.py", line 505, in _prepare_file_
abstract_dist.prep_for_dist()
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\req\\req_set.py", line 123, in prep_for_dist
self.req_to_install.run_egg_info()
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\req\\req_install.py", line 376, in run_egg_info
self.setup_py, self.name,
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\pip\\req\\req_install.py", line 347, in setup_py
import setuptools # noqa
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\setuptools\__init_.py", line 8, in \<module\>
import _distutils_hack.override # noqa: F401_
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages_distutils_hack\\override.py", line 1, in \<module\>
__import__('_distutils_hack').do_override()_
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages_distutils_hack\__init_.py", line 72, in do_override
ensure_local_distutils()
File "c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\site-packages_distutils_hack\__init_.py", line 59, in ensure_local_distutils
assert '\_distutils' in core.__file__, core.__file__
AssertionError: c:\\users\\username\\appdata\\local\\programs\\python\\python35\\lib\\distutils\\core.py
You are using pip version 7.1.2, however version 22.0.4 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
First things first, upgrade your pip putting this in your cmd: python -m pip install --upgrade pip. Why are you installing lower version of pygame? Also if you don't have a specific reason to use python 3.9, you can install python 3.10. If that doesn't work, try reinstalling python so it reinstalls the pip and then try again.
I'm unable to install pip using python setup.py --user, and I think my python install is generally a bit foobared.
I want to be able to use pip without sudo on my user (vagrant in this case). Everything I've read indicates that the above should work, but it just refuses to.
If I use sudo python setup.py --user then it installs correctly, but again, the sudo shouldn't be necessary because of the installation to the user directory.
python setup.py --user
Traceback (most recent call last):
File "setup.py", line 6, in <module>
from setuptools import find_packages, setup
File "/home/vagrant/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 16, in <module>
import setuptools.version
File "/home/vagrant/.local/lib/python3.6/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/home/vagrant/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3126, in <module>
#_call_aside
File "/home/vagrant/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3110, in _call_aside
f(*args, **kwargs)
File "/home/vagrant/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3139, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/home/vagrant/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 572, in _build_master
ws = cls()
File "/home/vagrant/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 565, in __init__
self.add_entry(entry)
File "/home/vagrant/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 621, in add_entry
for dist in find_distributions(entry, True):
File "/home/vagrant/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1968, in find_on_path
for dist in factory(fullpath):
File "/home/vagrant/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2030, in distributions_from_metadata
if len(os.listdir(path)) == 0:
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/websocket_client-0.54.0.dist-info'
Other bits of info...
python -V
Python 3.6.7
which python
/usr/bin/python
Also, I know that I can use a venv to achieve what I want, but the point is it should work, and doesn't, which a) bugs me to no end, and b) indicates that something is just plain wrong with my setup.
It looks to me as if you are trying to install stuff to the system Python using a non root user and hence do not have permissions to edit stuff in the system's site-packages. Please can you run a whoami and see which user you are logged in as, if you are logged in as someone other than root you should use sudo to install packages into the system's Python, e.g. sudo pip install my_package.
If you do not want to install packages to the system's Python site-packages directory then you probably should be operating in a virtualenv, this gives you a self contained Python env for your project and can be created as any user in their home directory.
To get virtualenv installed:
sudo pip install virtualenv
Then to create a new virtualenv as the user:
virtualenv my_env
Assume / Activate the virtualenv:
source my_env/bin/activate
Now you can install packages using pip as your user into your Python virtualenv:
pip install my_package
This gives you a fully separate Python env running as your user from the system Python installation. Hopefully this helps you, if I have misunderstood your use case please leave a comment and I'll update my answer accordingly.
I am unable to create virtual environment using both Python 2.x or Python 3.x. When I try create virtual environment I get error:
$ virtualenv my_env2 [0:05:17] ⚡[..........]
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/user/my_env2/bin/python2
Not overwriting existing python script /home/user/my_env2/bin/python (you must use /home/user/my_env2/bin/python2)
Installing setuptools, pkg_resources, pip, wheel...
Complete output from command /home/lynx/my_env2/bin/python2 - setuptools pkg_resources pip wheel:
Traceback (most recent call last):
File "<stdin>", line 7, in <module>
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/__init__.py", line 31, in <module>
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/vcs/mercurial.py", line 9, in <module>
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 40, in <module>
ImportError: cannot import name requests
----------------------------------------
...Installing setuptools, pkg_resources, pip, wheel...done.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/virtualenv.py", line 2375, in <module>
main()
File "/usr/lib/python3/dist-packages/virtualenv.py", line 724, in main
symlink=options.symlink)
File "/usr/lib/python3/dist-packages/virtualenv.py", line 992, in create_environment
download=download,
File "/usr/lib/python3/dist-packages/virtualenv.py", line 922, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/usr/lib/python3/dist-packages/virtualenv.py", line 817, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/user/my_env2/bin/python2 - setuptools pkg_resources pip wheel failed with error code 1
The same error occurs for Python 3.x. Can you help me?
I had a similar problem when trying to do this with Python3. Try this command:
sudo python3 -m <your virtual env name>
First, make a directory of any name :
mkdir testing
Then, moved to this newly created directory named testing :
cd testing
When you type following command in this directory:
python3 -m venv env
You got error like :
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt install python3.8-venv
Type the following command but before that keep an eye on the version of python you installed on the machine; in my case its python3.8
sudo apt install python3.8-venv
Now, we can create a virtual environment and store its tools in the "bhandari" folder .
python3 -m venv bhandari
Note: you can named this "bhandari" folder; anyname you like( Standard practice is to name it "env" ...)
Now to activate your virtual environment, from the directory of your folder, type the following command this will activate our virtual environment in the “bhandari” folder
source bhandari/bin/activate
If you have successfully activated your virtual environment, you should see the (bhandari) word indicating that we are working in a virtual environment.
After this, we can install anything that will be isolated from the rest of the system....
I am trying to upgrading pip from 8.1.1 to 8.1.2 .
But it showing following 'PermissionError: [WinError 5] Access is denied:
How to upgrade pip?
C:\>python -m pip install --upgrade pip
Collecting pip
Using cached pip-8.1.2-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 8.1.1
Uninstalling pip-8.1.1:
Exception:
Traceback (most recent call last):
File "C:\Program Files\Python35\lib\shutil.py", line 538, in move
os.rename(src, real_dst)
PermissionError: [WinError 5] Access is denied: 'c:\\program files\\python35\\lib\\site-packages\\pip-8.1.1.dist-info\\description.rst' -> 'C:\\Users\\user\\AppD
ata\\Local\\Temp\\pip-nen4ldwg-uninstall\\program files\\python35\\lib\\site-packages\\pip-8.1.1.dist-info\\description.rst'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python35\lib\site-packages\pip\basecommand.py", line 209, in main
status = self.run(options, args)
File "C:\Program Files\Python35\lib\site-packages\pip\commands\install.py", line 317, in run
prefix=options.prefix_path,
File "C:\Program Files\Python35\lib\site-packages\pip\req\req_set.py", line 726, in install
requirement.uninstall(auto_confirm=True)
File "C:\Program Files\Python35\lib\site-packages\pip\req\req_install.py", line 746, in uninstall
paths_to_remove.remove(auto_confirm)
File "C:\Program Files\Python35\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
renames(path, new_path)
File "C:\Program Files\Python35\lib\site-packages\pip\utils\__init__.py", line 267, in renames
shutil.move(old, new)
File "C:\Program Files\Python35\lib\shutil.py", line 553, in move
os.unlink(src)
PermissionError: [WinError 5] Access is denied: 'c:\\program files\\python35\\lib\\site-packages\\pip-8.1.1.dist-info\\description.rst'
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
This problem occurs even with administrator privileges.
open your cmd with admin priviliges. for that right click in icon and select open with administrator.
Upgrade PIP on your default python environment required sudo, i.e. in Windows term, you must your start command prompt as administrator mode. In fact, this is not recommended.
You don't need to use sudo/'Windows adminsitrators" if you setup virtualenv. It is python best practice to setup Python virtualenv , So you can separate the pip package required for individual project. For windows, it is similar setup.
Nevertheless, if you have decent PC with enough RAM, just install Virtualbox and deploy ubuntu. This way, your don't need to deal with windows python package installation/upgrade that overlook by developer (although all python package suppose to work out of the box) .
After installing ipython on Windows via pip install ipython, I am unable to run it and receive the following error.
> ipython
Traceback (most recent call last):
File "C:\Python27\scripts\ipython-script.py", line 5, in <module>
from pkg_resources import load_entry_point
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2607, in <module>
parse_requirements(__requires__), Environment()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: pyreadline>=1.7.1
pyreadline was installed when ipython was via pip, but pip freeze shows warnings about the SVN location
> pip freeze
Warning: cannot find svn location for pyreadline==1.7.1.dev-r0
...
ipython==0.13.1
## FIXME: could not find svn URL in dependency_links for this package:
pyreadline==1.7.1.dev-r0
...
The solution was to uninstall the version of pyreadline pulled when ipython was installed (pip uninstall pyreadline) and download and install pyreadline-1.7.1.win32-py2.7.exe from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyreadline