Permission denied install pyforest notebook extension - python-3.x

I have installed pyforest with :
pip install --upgrade pyforest
It worked well, but when I run on terminal :
python -m pyforest install_extensions
I have this output :
Starting to install pyforest extensions for Jupyter Notebook and Jupyter Lab
Trying to install pyforest nbextension...
Traceback (most recent call last):
File "/home/bled/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/bled/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/bled/anaconda3/lib/python3.7/site-packages/pyforest/main.py", line 15, in
install_extensions()
File "/home/bled/anaconda3/lib/python3.7/site-packages/pyforest/utils.py", line 19, in install_extensions
install_nbextension()
File "/home/bled/anaconda3/lib/python3.7/site-packages/pyforest/utils.py", line 38, in install_nbextension
nbextensions.install_nbextension_python("pyforest")
File "/home/bled/anaconda3/lib/python3.7/site-packages/notebook/nbextensions.py", line 225, in install_nbextension_python
destination=dest, logger=logger
File "/home/bled/anaconda3/lib/python3.7/site-packages/notebook/nbextensions.py", line 126, in install_nbextension
ensure_dir_exists(nbext)
File "/home/bled/anaconda3/lib/python3.7/site-packages/jupyter_core/utils/init.py", line 13, in ensure_dir_exists
os.makedirs(path, mode=mode)
File "/home/bled/anaconda3/lib/python3.7/os.py", line 211, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/home/bled/anaconda3/lib/python3.7/os.py", line 221, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/share/jupyter'
I have tried :
python -m pyforest install_extensions --user
But it doesn't work either and instead gives the following output:
Usage: python -m pyforest install_extensions installs notebook/lab
extensions
Can somone please help?

'python -m pyforest install_extensions' run this command on anaconda prompt not on terminal. There is another way we can install the extensions directly from jupyter notebook. These are the commands to follow
import pyforest
pyforest.install_nbextension()
pyforest.install_labextension()

Related

OSError: Python library not found: libpython3.7.so.1.0, libpython3.7m.so.1.0

I am using pyinstaller on CentOS 7 to convert a .py file to an executable. I am on python3.7.6
I have done:
$python3.7 -m pip install pyinstaller
$pyinstaller test.py --onefile
This gives me:
8942 INFO: Python library not in binary dependencies. Doing additional searching...
Traceback (most recent call last):
File "/usr/local/bin/pyinstaller", line 8, in <module>
sys.exit(run())
File "/usr/local/lib/python3.7/site-packages/PyInstaller/__main__.py", line 126, in run
run_build(pyi_config, spec_file, **vars(args))
File "/usr/local/lib/python3.7/site-packages/PyInstaller/__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 815, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 762, in build
exec(code, spec_namespace)
File "/root/test.spec", line 19, in <module>
noarchive=False)
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 294, in __init__
self.__postinit__()
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/datastruct.py", line 159, in __postinit__
self.assemble()
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 540, in assemble
self._check_python_library(self.binaries)
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 645, in _check_python_library
python_lib = bindepend.get_python_library_path()
File "/usr/local/lib/python3.7/site-packages/PyInstaller/depend/bindepend.py", line 967, in get_python_library_path
raise IOError(msg)
OSError: Python library not found: libpython3.7.so, libpython3.7.so.1.0, libpython3.7mu.so.1.0, libpython3.7m.so, libpython3.7m.so.1.0
This would mean your Python installation doesn't come with proper library files.
This usually happens by missing development package, or unsuitable build parameters of Python installation.
* On Debian/Ubuntu, you would need to install Python development packages
* apt-get install python3-dev
* apt-get install python-dev
* If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)
As pointed out here I have tried:
$env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.7.6
I have also installed python-devel:
$yum install python36-gobject-devel.x86_64
$yum install python3-devel.x86_64
$yum install python34-devel.x86_64
I am not sure what am I missing here. Any help will be appreciated.

Can not run virtualenv successfully on win10

I use python36 and win10, I can install virtualenv successfully. But when I want to activate it, some mistakes have occurred.
$pip install virtualenv
Requirement already satisfied: virtualenv in c:\users\appdata\local\programs\python\python36\lib\site-packages
$virtualenv venv
Using base prefix 'c:\\users\\appdata\\local\\programs\\python\\python36'
New python executable in C:\Users\myvenv\venv\Scripts\python.exe
Installing setuptools, pip, wheel...
Complete output from command C:\Users\myvenv\venv\Scripts\python.exe - setuptools pip wheel:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
ModuleNotFoundError: No module named 'pkgutil'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "c:\users\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\AppData\Local\Programs\Python\Python36\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
File "c:\users\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 713, in main
symlink=options.symlink)
File "c:\users\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 945, in create_environment
download=download,
File "c:\users\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 901, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "c:\users\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 797, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command C:\Users\myvenv\venv\Scripts\python.exe - setuptools pip wheel failed with error code 1
Why is there such a problem?
In fact, you don't need to reinstall your python, instead, you can just entry virtualenv envname --no-setuptools --no-pip --no-wheel in your cmd line, hope be helpful.

Error while installing Selenium in pip3

I am attempting to install selenium, and yet there seems to be a problem:
I ran pip3 install -U selenium, and I get:
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python3.5/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/usr/local/lib/python3.5/site-packages/pip/req/req_set.py", line 742, in install
**kwargs
File "/usr/local/lib/python3.5/site-packages/pip/req/req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/local/lib/python3.5/site-packages/pip/req/req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python3.5/site-packages/pip/wheel.py", line 378, in move_wheel_files
clobber(source, dest, False, fixer=fixer, filter=filter)
File "/usr/local/lib/python3.5/site-packages/pip/wheel.py", line 317, in clobber
ensure_dir(destdir)
File "/usr/local/lib/python3.5/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/local/Cellar/python3/3.5.2_2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/os.py", line 231, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/local/Cellar/python3/3.5.2_2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/os.py", line 231, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/local/Cellar/python3/3.5.2_2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/os.py", line 231, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/local/Cellar/python3/3.5.2_2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/os.py", line 241, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/selenium'
Despite this message, I can proceed and run selenium in python3, and a command like
from selenium import web driver
browser = webdriver.Firefox()
will return
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "/usr/local/Cellar/python3/3.5.2_2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/usr/local/Cellar/python3/3.5.2_2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 135, in __init__
self.service.start()
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 71, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
What do I need to do?
It can also be done without executing pip as superuser (which you should, at least, try not to):
Create the directory:
sudo mkdir /usr/local/selenium
Give yourself ownership of the directory:
chown your_username /usr/local/selenium
Install Selenium:
pip3 install -U selenium
Did you try to run pip install as a super user? It's common to have PermissionError when you miss the sudo. If you didn't, try sudo pip3 install -U selenium.

Confusing error when attempting to start the Jupyter notebook

The following output appeared when I was attempting to start an instance of the Jupyter botebook:
C:\Users\CaitlinG>jupyter notebook
Traceback (most recent call last):
File "c:\users\caitling\appdata\local\programs\python\python35\lib\runpy.py",
line 184, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\caitling\appdata\local\programs\python\python35\lib\runpy.py",
line 85, in _run_code
exec(code, run_globals)
File "C:\Users\CaitlinG\AppData\Local\Programs\Python\Python35\Scripts\jupyter
-notebook.exe\__main__.py", line 5, in <module>
File "c:\users\caitling\appdata\local\programs\python\python35\lib\site-packag
es\notebook\notebookapp.py", line 31, in <module>
from zmq.eventloop import ioloop
File "c:\users\caitling\appdata\local\programs\python\python35\lib\site-packag
es\zmq\__init__.py", line 37, in <module>
_libzmq = ctypes.cdll.LoadLibrary(bundled[0])
File "c:\users\caitling\appdata\local\programs\python\python35\lib\ctypes\__in
it__.py", line 425, in LoadLibrary
return self._dlltype(name)
File "c:\users\caitling\appdata\local\programs\python\python35\lib\ctypes\__in
it__.py", line 347, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
I am using Windows 10 and Python 3.5.2. I installed the package, along with its dependencies, via: pip3 install "ipython[notebook]" --upgrade
The aforementioned process proceeded without incident but I am confused why the issue has appeared.
Thanks.
It seems to be an issue with pyzmq 15.3. Installing a previous version worked for me:
pip install pyzmq==15.2
See:
https://github.com/jupyter/help/issues/62
Good luck!

Unable to setup a virtualenv in ubuntu

I am following these steps to setup a virtual environment in Ubuntu 13.10 64-bit.
https://askubuntu.com/questions/244641/how-to-set-up-and-use-a-virtual-python-environment-in-ubuntu
After setting up the various things in bashrc and then on executing source .bashrc. I get the following traceback.
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/virtualenvwrapper/hook_loader.py", line 16, in <module>
from stevedore import ExtensionManager
File "/usr/local/lib/python2.7/dist-packages/stevedore/__init__.py", line 11, in <module>
from .extension import ExtensionManager
File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 4, in <module>
import pkg_resources
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2825, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 710, in subscribe
callback(dist)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2825, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2257, in activate
self.insert_on(path)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2364, in insert_on
self.check_version_conflict()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2403, in check_version_conflict
for modname in self._get_metadata('top_level.txt'):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2251, in _get_metadata
for line in self.get_metadata_lines(name):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1219, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1211, in get_metadata
return self._get(self._fn(self.egg_info,name))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1326, in _get
stream = open(path, 'rb')
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/google_api_python_client-1.2-py2.7.egg/EGG-INFO/top_level.txt'
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenv has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.
It seems that it is unable to find the installation of python. I too am puzzled bacause on executing "which python", I get /usr/bin/python but when I got /usr/bin, I am unable to find the python directory .Please help...
Thanks.
Permission denied seems like u need to be root to do that. Maybe you should use "sudo" before using the command which gives you the error
Did you install virtualenvwrapper? If yes, then sudo like mentioned by user2270433. If no, then install that and proceed with the instructions. I haven't used virtualenvwrapper, but the standard steps for virtualenv in my bootstraps are like this...
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo -n python ez_setup.py && sudo python get-pip.py
sudo -n pip install virtualenv

Resources