I've been trying to figure out how I can open a .ipynb file on double-click on a Mac, so the file opens with Anaconda and then automatically opens Jupyter Notebook with the file contents.
I have tried creating an application through Automator that opens with a jupyter_lab command, but the issue is that Jupyter lives in Anaconda, so this method is not working. See these articles for my steps: https://samedwardes.com/2020-01-31-open-ipynb-with-double-click/ and Open an ipython notebook via double-click on osx
I have also tried installing nbopen with the following:
python3 -m pip install nbopen
This works, and then I can run nbopen file.ipynb through the terminal, but I want to be able to bypass this step and do it while in file explorer, physically looking at the file instead.
I have ran the recommended command for osx to integrate it with file manager ./osx-install.sh but I just get zsh no such file or directory and can't really find any help with figuring out why this is pushing back an error.
Any suggestions?
I have this "convenience issue" as well, and didn't go for the nbopen route, but instead, I just made a batch script (I named it jupyter-notebook.bat) that calls certain conda functions, and pretty much initiates things like how double clicking works. In the script, I just have this:
call "C:\Users\XYZ\Anaconda3\Scripts\activate.bat"
call conda activate myEnvironment
call python C:\Users\XYZ\Anaconda3\Scripts\jupyter-notebook-script.py %1
Lastly you just need to configure that every .ipynb opens up using your jupyter-notebook.bat script.
For consistency, I placed the script in my Anaconda folder. And if you also have nb_conda_kernels installed in your base environment, you'd have access to the other environment you've created as well from there.
I am trying to do the following in Python 3.7.1 on Windows
import sqlite3
but I get the following error message
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "c:\programdata\anaconda3\lib\sqlite3\__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "c:\programdata\anaconda3\lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: DLL load failed: The specified module could not be found.
I have searched for a solution to the problem for quite a while now to no avail. I have also successfully run pip install pysqlite3 on the Anaconda prompt, but the import still fails. What do?
I got this working on windows by downloading: the sqlite3 dll (find your system version)
And placing it into the folder: C:\Users\YOURUSER\Anaconda3\DLLs
(Depending on how you installed Anaconda, this may have to be placed into
the following folder: C:\ProgramData\Anaconda3\DLLs)
According to #alireza-taghdisian, you can locate the exact path of
your conda environments (where you need to copy the sqlite3 dll) by typing:
conda info --envs on your anaconda prompt.
Locate the sqlite3.dll file. In my case it was in following folder
C:\Users\Admin\anaconda3\Library\bin
where C:\Users\Admin\anaconda3 is the folder where Anaconda was installed
Add this to PATH in environment variables, and it should work then.
Try copying the sqlite3.dll from the
C:\Users\YOURUSER\anaconda3\Library\bin
folder to
C:\Users\YOURUSER\Anaconda3\DLLs
Please check https://github.com/jupyter/notebook/issues/4332
I added anaconda root/Library/bin to my PATH and now it works!
Add CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1 to your environment variables.
before executing the program, enter conda activate in your shell.
I had tried all above solutions But for me and my system I got to know that
I downloaded Python in C:\Python27 hence there is dll folder in python C:\Python27\DLLs
I installed Sqlite3.dll in my above dll folder
May be this solution will help you because it completely depends on where do you install your python
Happy coding :)
I put the sqlite3.dll in the path folder of my Python venv and still wont work. I suspected it is a path problem.
(In my case: E:\Virtual_Env\mini_zinc\env\Scripts)
I found in my case I messed up installation in a virtual evn, somehow using an anaconda python kernel within a Python venv.
I reinstall the Python Venv and check the python version after installed Env is correct (not the Anaconda python), then proceed with Jupyter Notebook (or Juyterlab) and works fine.
I was able to resolve this issue by putting sqlite3.dll file in the C:\Users<USERID>\AppData\Local\conda\conda\envs<ENV NAME>\DLLs.
Download sqlite3.dll file from https://www.sqlite.org/download.html
or copy it from C:\ProgramData\Anaconda3\DLLs\
I found the #elgsantos useful. But for those who are new to Python and Conda like me, I would like to add a little bit of details.
1- I use miniconda3 for creating new environment.
2- interestingly, I got two installation path on my computer for conda: the first one (the obvious) is located on "C:\Users\taghdisian\miniconda3". The second one is on "C:\Users\taghdisian\AppData\Local\r-miniconda". The latter is the primary path that you need to copy your sqlite3 files into the envs folder. I copy them in the "C:\Users\taghdisian\AppData\Local\r-miniconda\envs\sdr3.9\DLLs" in which the sdr3.9 is one of my virtual Condo environment.
you can locate the exact path of your conda environments (where you need to copy sqlite3) by typing the conda info --envs on your anaconda prompt.
I hope this help.
got the same error while loading the jupyter notebook from other conda prompt than "base" environment.
[1]: https://i.stack.imgur.com/2DW7E.png
Resolved by installing sqlite package
(nlpenv) C:\Users\arunk>conda install sqlite
launching
*
(nlpenv) C:\Users\arunk>jupyter notebook
I am trying to get the ipynb running on my Mac, but I am running into some trouble. I specifically want to run the ipynb that comes with Anaconda.
This question is very close to helping me but I am not sure what to do with the results from checking which python, which python2.7, which ipython.
When I type 'ipython' into the terminal, I get
/bin/bash: /Users/me/anaconda/bin/python.app: No such file or directory
Anaconda isn't even located in /Users/me/ so I don't know why bash is looking there when I've put /usr/local/bin/anaconda/bin at the front of my path (which I did after that post suggested I check my path variable).
$ which anaconda
/usr/local/bin/anaconda/bin/anaconda
$ which python
/usr/local/bin/anaconda/bin/python`
$ which python2.7
/usr/local/bin/anaconda/bin/python2.7
$ which ipython
/usr/local/bin/anaconda/bin/ipython
I tried this to see if it worked, because I'm guessing it is related to the problem I am having:
$ conda -h
-bash: /usr/local/bin/anaconda/bin/conda: /Users/me/anaconda/bin/python: bad interpreter: No such file or directory`
From the responses I'm getting from bash, it looks like everything is pointing to where it should be, so then why, when I type ipython or conda into the terminal, do I get those errors?
(Not sure if this is related, but some posts I've seen refer to changing the pip file to point to the version of Python I want, but I am not quite sure where to find the 'pip file'. I went looking for it wherever my pip is stored but I couldn't find a file per say.)
It is most likely looking in the wrong place. Standard installations would be in /Users/username/anaconda/bin. If you have installed it in /usr/local/bin/anaconda/bin/python you will want to be sure it is in you .bash_profile. In terminal run the following:
open .bash_proflie
Add the following:
export PATH="/usr/local/bin/anaconda/bin:$PATH"
Again the usual Path would be:
export PATH="/Users/me/anaconda/bin:$PATH"
Be sure to relaunch terminal or run "source .bash_profile"
I solved this problem by moving anaconda to root ("/")
I was doing a fresh installation for Python 2.7.9 and 3.4.3 on Win7 X64 today, and I found that there is no Script folder in Python27 and Python34 folder as first child level folder, but there is one in Tools. However, I couldn't find pip within that Script folder, although pip should be installed with Python by default. The other I was doing the same installation for my other PC and laptop, there was Script folder (as first level child folder in Python27 and Python34) containing pip. So what is going on? how to install pip and maybe other useful scripts this way?
[EDIT] I tried python -m ensurepip in Python34. I got the following errors:
Ignoring indexes: https://pypi.python.org/simple
Collecting setuptools
Exception:
Traceback (most recent call last):
File "C:\Users\daiyue\AppData\Local\Temp\tmppvmc8dv1\pip-6.0.8-py2.py3-none-
any.whl\pip\basecommand.py", line 232, in main
status = self.run(options, args)
File "C:\Users\daiyue\AppData\Local\Temp\tmppvmc8dv1\pip-6.0.8-py2.py3-none-
any.whl\pip\commands\install.py", line 339, in run
requirement_set.prepare_files(finder)
File "C:\Users\daiyue\AppData\Local\Temp\tmppvmc8dv1\pip-6.0.8-py2.py3-none-
any.whl\pip\req\req_set.py", line 333, in prepare_files
upgrade=self.upgrade,
File "C:\Users\daiyue\AppData\Local\Temp\tmppvmc8dv1\pip-6.0.8-py2.py3-none-
any.whl\pip\index.py", line 326, in find_requirement
file_locations, url_locations = self._sort_locations(locations)
File "C:\Users\daiyue\AppData\Local\Temp\tmppvmc8dv1\pip-6.0.8-py2.py3-none-
any.whl\pip\index.py", line 158, in _sort_locations
sort_path(os.path.join(path, item))
File "C:\Users\daiyue\AppData\Local\Temp\tmppvmc8dv1\pip-6.0.8-py2.py3-none-
any.whl\pip\index.py", line 139, in sort_path
if mimetypes.guess_type(url, strict=False)[0] == 'text/html':
File "C:\Python34\lib\mimetypes.py", line 287, in guess_type
init()
File "C:\Python34\lib\mimetypes.py", line 348, in init
db.read_windows_registry()
File "C:\Python34\lib\mimetypes.py", line 255, in read_windows_registry
with _winreg.OpenKey(hkcr, subkeyname) as subkey:
TypeError: OpenKey() argument 2 must be str without null characters or None, not str
[EDIT] The problem is due to multiple null Registry keys in HKEY_LOCAL_MACHINE that make read_windows_registry() in mimetypes.py searches failed. Here is the post that leads to the solution:
Python ‘pip’ and Windows registry corruption
thanks
If you used the PSF (python.org) .msi Windows installers, pip (and dependencies) should be installed in pythonxy/Lib/site-packages for 3.4.0+ and 2.7.9+. There should also be pythonxy/Scripts containing about 5 .exes. This is the last part of the install process. A command prompt window should briefly appear. Perhaps you did not have [ ] install pip checked when doing the installs (although this should have been checked by default). Perhaps there was an error that you missed.
In any case, you should have pythonxy/Lib/ensurepip/* present for both 2.7 and 3.4 and you should be able to run this module now. In Command Prompt, try python -m ensurepip in both .../python27 and .../python34.
Had the same issue, reinstalling didn't help.
Finally fixed it by running python -m ensurepip as administrator.
This problem is a official bug: Issue23604 .
I had encountered the same problem, and fixed it successfully using the method in
Swarley's Blog.
I ran into the same issue today while trying to install Python 2.7.13 in my computer; after some investigation I realized that v.3.60 ("Anaconda") was already present (it came along with Microsoft Visual Studio 2017, which I've installed a couple weeks ago).
I suspected of some path mismatch in the registry, so I tried removing both Python v. 3.60 and 2.17, and cleaning up the Registry by deleting the HKCU\Software\Python key (which, due to some reason, was still present).
After this, I was able to correctly install version 2.7.13, and this time the \scripts folder is present, with all the expected contents.
I don't know if installing v. 3.6 again would cause any problem: I'm not going to try this for the time since I'm currently developing for v.2.7.
Hope this can be of some help, anyway.
Max - Italy
EDIT:
I've made some further investigation and think I've discovered the reason why (in my case), the \Scripts folder was missing: the path where I was going to install Python is in virtual drive.
In my computer I only have one partition (C:), and i've mapped a folder (C:\Development) as D:, then I tried to install Python on D:\Python27; apparently this is not "good" and causes some problem in the installer.
After discovering that, I tried installing to the real path, and now everything seems to be OK.
Max.
Resolved by installing Python 2.7.13
https://www.python.org/downloads/release/python-2713/
Windows 10. I had this issue while installing Python 2.7 into C:/Program Files/Python27 .. I think in this case it was a path issue. Fix was to do an install into C:/Python27, copy the Scripts folder from that installation to the installation in C:/Program Files/Python27. Everything else (including the paths to Python and Scripts) was fine.
Based on a combination of whats here, and what I found elsewhere, here is how I fixed it:
Uninstall whatever is installed already.
Go to regedit and HKLM/SOFTWARE/Python and delete the whole python section.
Reinstall Python
This installed with the scripts folder this time.
Hope this helps someone.
Guess what? In case you have NetBeans (or probably GlassFish) installed, then it could break installation for pip!
Details: there's a bug in NetBeans installer that could sometimes break the Windows registry in a way that's not expected by other installers.
#J3soon's answer was close, but Swarley's blog post haven't fixed the problem in my environment, because it wasn't a null character but was another kind of registry corruption.
And here's how I got rid of the issue. Run the following PowerShell script:
$local_key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
$machine_key = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
$machine_key6432 = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
$items = Get-ChildItem #($local_key, $machine_key, $machine_key6432)
$ErrorActionPreference = 'Stop'
foreach ($item in $items) {
Write-Output $item.PSPath
$null = Get-ItemProperty $item.PSPath
}
It will write the registry key names to the output. In case it prints an error, take the one last key it printed and remove that from the registry (using PowerShell or regedit or whatever tool you prefer).
After that, reinstall Python, and it should install pip as intended.
I am using python 3.6.2 and faced a similar issue of missing scripts folder(also pip script) in python folder. I have done following things to add scripts folder again to python.
Goto - Control Panel\All Control Panel Items\Programs and Features
then look for python program and try to uninstall it. A pop window
will appear which shows the following image.
Image Python
Try to REPAIR the installed program that should fix the issue.
Otherwise click on MODIFY and tick on pip check box and Add Python to environment variables checkbox, then install it. This should fix the issue.
Even I was facing this issue. I solved it by doing the following steps:
Uninstall python. (you can use the installer(python-2.7.xx.msi) to perform the uninstall. Select the option 'Remove Python'on double clicking the installer.)
Edit the environment variable 'Path', and remove the python directory path. ( To change the environment variable, right click on 'This PC', click properties, click 'Advanced System Properties' ->Environment Variables)
Remove the environment variable 'Python Path' if present.
Now reinstall python.
It will work !!!
Actually Scipts folder will not create after installing python, you have to manually create this folder and then install pip, then you can find the required files in this directory.
I had also faced the same problem which i managed to solve. The problem is when you install the python in default configuration then it installs the python folder in the "c:\user\Appdata......" which is lengthy and hard to find . To avoid it first uninstall the python 3.7 completely from the system from the control panel ->uninstall program. Then install it again with the option " customize installation". On the next page change the default location to C:/Python/Python37-32 and select the required check boxes and click install. This should solve your problem.
It is permission issue. I have both python 2 and 3 installed under
C:\Program Files\python\2.7.16
C:\Program Files\python\3.7.2
Python 2 installer is msi, so there is no run as admin option when install it
Python 3 installer is exe, there is run as admin option.
As the results, python 2 installed without scripts and pip.exe and python 3 installed successfully.
To fix this, simply give the full permission to everyone on
C:\Program Files\python\ and install python 2 again. then change the permission back.
That's it.
This Command works fine for me:
python -m ensurepip
Looking in links: C:\Users\kjangala\AppData\Local\Temp\tmpvd4_442i
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-19.0.3 setuptools-40.8.0
I had this issue after getting a new computer and restoring my appdata folder (an enterprise system did this automatically for me). Somehow some old metadata in my %userprofile%\AppData\Local\Programs\Python folder made the Scripts folder inside end up empty when I reinstalled Python.
I deleted this folder and uninstalled/reinstalled Python, and everything is working again.
Edit: I also had to delete %userprofile%\AppData\Roaming\Python to resolve another similar error. Interestingly, this one didn't get recreated on the reinstall.
It is simple,
Download this file Get Pip. Save it in your local with the extension .py
To run in windows:
1.) Open cmd
2.) type "python" and check if python is been installed
3.) type "python filePath.py" (example if you saved your file in C drive go the particular folder and run the command - Here "filePath.py" is the filename you saved)
command looks like this
4.) Cheers now it should work
5.) To check if pip installed properly type "pip --version"
I had the same issue (win 10, py 3.8.5, executable installer). The solution i've found is to install python to non-standard catalog (D:/ instead of windows user folder which is under access protection). In this case, the file "easy_install.exe" will be created in the Scripts folder. Then open console inside the folder and call "easy_install pip", this will install pip. After that just copy everything to the standard catalog and don't forget to change the environment variables.