Traceback (most recent call last):
File "D:\Anaconda3\envs\sklearn_tut.yml\Scripts\jupyter-script.py", line 10, in <module>
sys.exit(main())
File "D:\Anaconda3\envs\sklearn_tut.yml\lib\site-packages\jupyter_core\command.py", line 247, in main
command = _jupyter_abspath(subcommand)
File "D:\Anaconda3\envs\sklearn_tut.yml\lib\site-packages\jupyter_core\command.py", line 134, in _jupyter_abspath
'Jupyter command `{}` not found.'.format(jupyter_subcommand)
Exception: Jupyter command `jupyter-lab` not found.
I've run python -m ipykernel install --user --name=xxx and tried jupyter-lab and jupyter lab, both failed.
But later I installed jupyter notebook with conda create -n python36 python=3.6 and it ran just fine. I can't understand what went wrong.
In my opinion, Anaconda is best for the beginners. In my own experience with Anaconda, it reminded me of some of those PC anti-virus programs of years past which prevented me from performing many of my normal operation on the PC. Once I was prevented from doing what I wanted with the computer, then that software was immediately uninstalled.
Once it became apparent that Anaconda was interfering with what I intended, then I uninstalled Anaconda and the associated python installation(s). I reinstalled Python and then I used pip to install python packages and updates. I was doing the package management, which if I recall, Anaconda was interfering with my ability to use pip and making my control over python, virtual environments, etc.. difficult.
You can install the IRkernel without Anaconda. Here are the steps to perform using RStudio:
>install.packages("devtools") # install and then open library
>devtools::install_github("IRkernel/IRkernel") # can't recall, may need to open library
>IRkernel::installspec() # All done. Select a working director then type; 'Jupyter Lab'
IMO, everyone other than complete novices and neophytes, should be installing applications themselves and then doing the package management without using Anaconda.
Related
for my homework we need to use jupyter notebook to run an .ipynb file. I use Mac and I used pip install jupyter to install it using terminal, which was successful. However when I tried to open it using the commandjupter notebook I get this error. Any ideas? Thanks.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/jupyter-notebook", line 5, in
from notebook.notebookapp import main
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/notebookapp.py", line 76, in
from .base.handlers import Template404, RedirectWithParams
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/base/handlers.py", line 24, in
import prometheus_client
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/prometheus_client/init.py", line 3, in
from . import (
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/prometheus_client/gc_collector.py", line 43, in
GC_COLLECTOR = GCCollector()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/prometheus_client/gc_collector.py", line 14, in init
registry.register(self)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/prometheus_client/registry.py", line 26, in register
names = self._get_names(collector)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/prometheus_client/registry.py", line 66, in _get_names
for metric in desc_func():
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/prometheus_client/gc_collector.py", line 36, in collect
collected.add_metric([generation], value=stat['collected'])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/prometheus_client/metrics_core.py", line 126, in add_metric
self.samples.append(Sample(self.name + '_total', dict(zip(self._labelnames, labels)), value, timestamp))
TypeError: new() missing 1 required positional argument: 'exemplar'
From your terminal out screen grab, I can see that you are not in a virtual environment which would mean that you are using global python.
Three things to check and or consider:
1. Python Version (management and checking).
To avoid the type of error that you are seeing- creating dependency issues of your versions of python, it may be an idea to use a package manager like conda or use virtual environments and install within them.
2. Proper use of pip install:
If you do not want to use vnev's or a package manager like conda perhaps double-check that you have installed on the correct version of python and install jupyter on the version of python you want to use.
python3.6 -m pip install jupyter
3. Environment Management:
There are a number of different options for managing the python version some people like to create virtual environments within your present working directory and active them using:
python3.6 -m pip install virtualenv
python3.6 -m venv env_name
source env_name/bin/activate
Once activated your terminal will show:
(env_name) jeffmpro....
You can then pip install jupyter inside this environment and this will then run using:
jupyter notebook
If you want to manage the python version and virtual environments globally using shims you can do this using a package called pyenv:
https://github.com/pyenv/pyenv
https://github.com/pyenv/pyenv-virtualenv
I would also use homebrew on mac to manage installations in the command line.
https://brew.sh/
Hope this helps :-)
The correct answer is actually what came out in the comments, I'll report it here for future viewers:
pip install jupyter
pip install notebook
jupyter-notebook your-file.ipynb
See you!
In my windows 10 , when I am attempting to open spyder by anaconda navigator , this happens :
Application spyder launch may have produced errors Traceback (most recent call last): File "C:\Users\username\Anaconda3\Scripts\spyder-script.py", line 10, in sys.exit(main()) File "C:\Users\username\Anaconda3\lib\site-packages\spyder\app\start.py", line 190, in main from spyder.app import mainwindow File "C:\Users\username\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 51, in requirements.check_spyder_kernels() File "C:\Users\username\Anaconda3\lib\site-packages\spyder\requirements.py", line 66, in check_spyder_kernels % actual_ver) File "C:\Users\username\Anaconda3\lib\site-packages\spyder\requirements.py", line 24, in show_warning raise RuntimeError(message) RuntimeError: Please check Spyder installation requirements: spyder-kernels
I have tried installing pyqt and did conda update --all .But nothing works ...
Please help .Thanks in advance.
versions : spyder - 3.3.1 python - 3.6.6
(Spyder maintainer here) This problem is caused by running conda update --all, which (in my opinion) is a bad strategy because it tries to install all packages without respecting the restrictions imposed by some packages on others.
In this case, Spyder 3.3+ demands spyder-kernels <1.0, but conda update --all installs spyder-kernels 1.0.1 and that breaks Spyder with the error above.
So the solution to this problem is the following:
Open an Anaconda Prompt
Run there the following commands
conda remove spyder-kernels
conda install spyder-kernels=0.*
Stop using conda update --all, or you'll get the same problem again.
I am trying to install TensorFlow by Anaconda(My Python is 3.5.2 edition).
When I run:
(tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
According to the guide in Tensorflow.org, the following tips emerge:
Exception:
Traceback (most recent call last):
File "C:\Users\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\Anaconda3\lib\site-packages\pip\commands\install.py", line 317, in run
prefix=options.prefix_path,
File "C:Anaconda3\lib\site-packages\pip\req\req_set.py", line 742, in install
**kwargs
File "C:\Users\Anaconda3\lib\site-packages\pip\req\req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "C:\Users\Anaconda3\lib\site-packages\pip\req\req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "C:\Users\Anaconda3\lib\site-packages\pip\wheel.py", line 346, in move_wheel_files
clobber(source, lib_dir, True)
File "C:\Users\Anaconda3\lib\site-packages\pip\wheel.py", line 324, in clobber
shutil.copyfile(srcfile, destfile)
File "C:\Users\Anaconda3\lib\shutil.py", line 115, in copyfile
with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Anaconda3\\Lib\\site-packages\\numpy\\core\\multiarray.cp35-win_amd64.pyd'
I don't know what causes this error. Can someone help me with that?
Might be late but I got the exact same error and this is what happened. My issue was that there was some file that was being used inside numpy that was locked by anaconda(or some other process) I guess and tensorflow needed that file. Hence I got permission denied. All I did was shut down every process anaconda, jupyter etc and ran:
1) conda update --all
2) pip install --ignore-installed tensorflow
Open your cmd as an administrator and do not activate tensorflow. Just simply fire commands from your cmd. For eg: C:\\> pip install --ignore-installed tensorflow (your directory may vary) should be fine. Let me know if you get stuck.
Run the cmd console as adminstrator, then execute you installation.
You can key cmd in run or Cortana, then right click the console and select run as adminstrator.
I had the same problem on several Windows machines (W7, W8.1 and W10). At last I solved the problem in the same way in all of them:
Uninstall Anaconda
Download Anaconda3-4.2.0 from Anaconda Installer Archive. This version of Anaconda includes Python 3.5.2. TensorFlow only supports version 3.5.x of Python on Windows.Although you can create an environment with version 3.5 of Python, I recommend installing Anaconda 4.2.0
Install Anaconda3-4.2.0 on a different drive than the Windows drive, for example in D:\Programdata\Anaconda3. Although installing on another drive is no longer necessary, better to select to install for all users.
Open an Anaconda Promp with administrator privileges and:
Create a environment named tensorflow by invoking the following command:
conda create -n tensorflow python=3.5
Activate the conda environment by issuing the following command:
activate tensorflow
Install TensorFlow:
conda install -c conda-forge tensorflow
Install Jupyter and Spyder at least, but surely you will need to install scipy too for example:
conda install spyder
conda install jupyter
After that you can check if all is correct by invoking python and trying the next program:
import tensorflow as tf
hail = tf.constant('Hello World')
session = tf.Session()
print(session.run(hail))
Now you can check if Spyder works. Exit from Python, invoke Spyder from Anaconda prompt and try de program.
If you have any problem with iPython, install it on the tensorflow enviroment.
conda install ipython
If you want to update spyder write the following command:
conda update spyder
Remember to launch Spyder from the Anaconda prompt after you have activated the tensorflow enviroment.
I hope it works for you.
Edited: TensorFlow, since version 1.2.0, is compatible with Python 3.6, so you can already install the latest version of Anaconda (4.4.0 | Release Date: May 31, 2017), which incorporates Python 3.6.
Maybe because there are other processes using tensorflow. Try to close these processes and then install or update tensorflow.
I had the same error and fixed it by running conda update --all first.
BUt be careful with conda update:
(https://github.com/ContinuumIO/anaconda-issues/issues/830)
Updating packages
conda: 4.0.5-py35_0 --> 4.1.1-py35_0
conda-env: 2.4.5-py35_0 --> 2.5.0-py35_0
matplotlib: 1.5.1-np110py35_0 --> 1.5.1-np111py35_0
mkl: 11.3.1-0 --> 11.3.3-1
mkl-service: 1.1.2-py35_0 --> 1.1.2-py35_1
numexpr: 2.5-np110py35_0 --> 2.5.2-np111py35_1
numpy: 1.10.4-py35_0 --> 1.11.0-py35_1
pandas: 0.18.0-np110py35_0 --> 0.18.1-np111py35_0
scikit-learn: 0.17.1-np110py35_0 --> 0.17.1-np111py35_1
scipy: 0.17.0-np110py35_0 --> 0.17.0-np111py35_4
will break Scripts/activate.bat under Windows if the install path contains spaces. (Replacing activate.bat with the original one just works fine.)
I had the same error for python 3.6, ran cmd through admin mode, worked like a charm.
I had permission denied problem on windows but this worked for me:
right click on cmd or git console > run as administrator
pip install tensorflow
I had a file locked up from a crashed Jupyter run. Rebooted and reinstalled as Adm. All good.
I solved problem by below command
pip install --upgrade
https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
I am working in windows7. and have pycharm installed along with anaconda spyder. I have been working in anaconda spyder for very long but now I want to use pycharm as it is better and easier to create projects.
so I created a new virtual environment and started a new project. Now when I try to specify my package installs via requirements.txt I get this error.
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition
2017.2.4\helpers\packaging_tool.py", line 192, in main
retcode = do_install(pkgs)
File "C:\Program Files\JetBrains\PyCharm Community Edition
2017.2.4\helpers\packaging_tool.py", line 109, in do_install
return pip.main(['install'] + pkgs)
AttributeError: module 'pip' has no attribute 'main'
I need help in fixing this. Nothing online has worked and I dont know where the problem is. I am using pip version of 10.
Should I uninstall my anaconda python. is it possible that it is interfering with pycharm?
Thanks
pip.main is no longer supported, and, as of 10.0, was removed. (See this documentation on what to do instead, but that probably isn't directly relevant to you—you're just trying to use PyCharm, not write your own replacement for PyCharm…)
Anyway, any graphical package manager that was built around calling pip.main, as PyCharm's used to be, breaks with 10.0. IIRC, PyCharm changed its code to handle this before 10.0 even went live. However, you're using an old version of PyCharm, which doesn't have those changes.
The obvious solution is to update PyCharm.
If you don't have any reason to use an old version, just get the latest version (as of today, 2018.1.4) by auto-updating, or by downloading it from the main Download page.
If you need to stick with an old version for some reason, get the latest 2017.2 version (as of today, 2017.2.7) from the Previous Releases page. This should be essentially the same as the version you have, but with critical fixes backported (which hopefully includes working with pip 10, although I haven't tested that).
The other option is to downgrade pip to a pre-10.0 version.
You can specify a version as just <10. If you want to specify one explicitly, I think 9.0.3 should be the last-ever 9.x version, but, to be safe, check the version history.
I don't know if downgrading pip with pip is supposed to work, but it actually did seem to work when I tried it on a test environment:
python3 -m pip install --force-reinstall 'pip<10'
If not, you can uninstall it and reinstall it:
python -m pip uninstall pip
python -m ensurepip
python -m pip install -U 'pip<10'
I wish to use anaconda distribution of ipython, but typing ipython at the terminal produces an error message:
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: ipython==0.13.1
Adding PATH to .bash_profile as below produces the same error message. Asking which python produces //anaconda/bin/python, and which ipython produces /usr/local/bin/ipython. How can I fix this such that ipython launches anaconda ipython?
# MacPorts Installer addition on 2012-11-03_at_23:50:01: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
# Add colors to terminal
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
# added by Anaconda 1.6.1 installer
export PATH="//anaconda/bin:$PATH"
export PATH=/anaconda//bin/isympy:$PATH
# added to Homebrew: bad command
export PATH=/usr/local/bin:$PATH
Update: I updated anaconda and ipython using conda update as suggested, but still get the same error message.
Update 2: Thanks for all the suggestions. I modified /usr/local/bin/ipython as follows:
#!//anaconda/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'ipython==1.1.0','console_scripts','ipython'
__requires__ = 'ipython==1.1.0'
import sys
from pkg_resources import load_entry_point
sys.exit(
load_entry_point('ipython==1.1.0', 'console_scripts', 'ipython')()
)
Now which ipython produces //anaconda/bin/ipython, and ipython launches.
Your problem is in your $PATH. If you look at your traceback, it's running /usr/local/bin/ipython - this is the one that is installed by Homebrew, and not by Anaconda. (Anaconda installs everything into /anaconda/bin.)
The reason this is getting picked up is because the very last line of your .bash_profile sticks /usr/local/bin at the front of your path. This means that the ipython that you installed via Homebrew is masking the one that's installed by Anaconda.
You have two options:
Uninstall the ipython that Homebrew installed, and just use Anaconda for your Python packages.
In your .bash_profile, move the Homebrew PATH modification line above the Anaconda one. This way, Anaconda's ipython, python, and various other Python commands will take precedence.
Remember, if you change your .bash_profile, you need to close your Terminal and start a new one for the changes to take effect.
It looks like your path is completely ok. Notice that the error comes from "/usr/local/bin/ipython". It is not a bash error, it is more likely an error involving setup_tools, or pip, that is Python packaging tools. Bash finds ipython and executes ipython startup file but encounters an error there.
The error appears to be saying that your version of ipython is incompatible. Have you tried doing something like this?
conda update conda
conda update ipython
Updaing conda and ipython is recommended in iPython documentation. Perhaps this will fix the problem. If not, then add an information saying that you updated conda and ipython to your question.
One possible reason is that there are multiple ipython versions installed e.g., brew might install to /usr/local/bin, conda might install to /anaconda/bin (it is just a guess). The advice from similar issue is to remove all ipython installation completely and install the one that you will use.
Ensure you check the path to the Python executable specified at the start of the script. When I installed iPython it was defined as:
#!/usr/bin/python
Instead of:
#!/usr/local/bin/python
Hence the default OS X install of Python was being used instead of my brew installed version.
For me was slightly different because even with Anaconda installed wasn't able to find the command or to run ipython and wasn't able to find the PATH.
My solution was to run these commands:
nano ~/.bash_profile
export PATH="/anaconda3/bin:$PATH"
source ~/.bash_profile
and then to check conda version:
conda
and I update conda and ipython running:
conda update conda
conda update ipython
Hope this could help someone.
This helped me: https://stackoverflow.com/a/49925193/3351569