error when running any .ipynb file in vscode - python-3.x

I already have jupyter notebook, and wanted to be able to run it in vs code.
I installed pip
PS C:\Users\ninet> py --version
Python 3.11.0
PS C:\Users\ninet> py -m pip --version
pip 22.3 from C:\Users\ninet\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip (python 3.11)
and also jupyter extension, but whenever i try to run a simple .ipynb at vscode there's an error
python: can't open file 'C:\\Users\\ninet\\AppData\\Local\\Programs\\Microsoft VS Code\\Untitled-1.ipynb': [Errno 2] No such file or directory
I think I need to fix the path somehow , how can i fix it?
I tried to set the name by
python -m ipykernel install --user --name conda --display-name
but it doesn't run

Related

Error when trying to install oct2py package

I am trying to install to oct2py package to import in my python script. However whenever I run the command pip install oct2py I get the following error:
Fatal error in launcher: Unable to create process using '"c:\python37\python.exe" "C:\Program Files\Python37\Scripts\pip.exe" ': file cannot be found.
How can I install oct2py?
Found the answer
Deinstalled python and reinstalled it. I checked the environment variable and changed it from this one : 'C:\Program Files\Python39' to this one 'C:\Users\lsee\AppData\Local\Programs\Python\Python39'.
Is unable to locate your pip installer, easy fix is unusually to either upgrade or test pip :
# to upgrade your pip
python -m pip install --upgrade pip
pip --version
# test you have pip in your machine
If your pip version is showing that means you have it installed, it could be a problem activating your virtual environnement, or your path.
It says the file cannot be locate, are you sure your path for Python and pip is correct ?
Try:
python -m pip install oct2py
This should work (as python -m pip install gave not errors)

Creating a virtualenv using Python 3 error

I have python in ConEMu loaded and am trying to creating a virtual environment to work in.
I used
pip3 install virtualenv --user
and it said that virtualenv was usccessfully installed, however then I try to
virtualenv .venv
and i get the error message
bash: virtualenv: command not found
wondering if anyone else has run into this problem
virtualenv is built into python 3, and called venv. You don't need to install anything with pip.
You can make a virtualenv in python 3 like this:
python3 -m venv ve

Dead Jupyter Kernel with python3

I am trying to use jupyter notebook with python3. Then I added the kernel with
python3 -m pip install ipykernel
python3 -m ipykernel install --user
But when I start a notebook it shows a Dead kernel message, and the terminal shows
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
If I choose python2 kernel it works well. I can run python command in console without any issue.
Try
python3 -m pip install --upgrade pip
python3 -m pip install jupyter
jupyter notebook
It worked for me.

Error: Creating Virtual Environment (with virtualenv) while setting up python Selenium via Terminal

I'm stuck trying to create a virtual environment. The instructions for this step are:
Create a new VirtualEnv in the directory for your Selenium files:
virtualenv -p /usr/bin/python3.0 venv
After checking my version of python I get: "Python 3.6.0 :: Anaconda 4.3.1 (x86_64)".
I tried replacing '3.0' with '3.6':
Wills-MacBook-Pro-2:my_selenium_project willdudek$ virtualenv -p /usr/bin/python3.6 venv
and get this error message:
The path /usr/bin/python3.6 (from --python=/usr/bin/python3.6) does
not exist
I also tried quitting terminal and reopening (so I'm not in my_selenium_project), importing virtualenv in Python, then trying to create a virtual environment using virtualenv my_selenium_project and that didn't work.
Do I need a different command since I'm running Python through Anaconda?

Error when executing `jupyter notebook` (No such file or directory)

When I execute jupyter notebook in my virtual environment in Arch Linux, the following error occurred.
Error executing Jupyter command 'notebook': [Errno 2] No such file or directory
My Python version is 3.6, and my Jupyter version is 4.3.0
How can I resolve this issue?
It seems to me as though the installation has messed up somehow. Try running:
# For Python 2
pip install --upgrade --force-reinstall --no-cache-dir jupyter
# For Python 3
pip3 install --upgrade --force-reinstall --no-cache-dir jupyter
This should reinstall everything from PyPi. This should solve the problem as I think running pip install "ipython[notebook]" messed things up.
For me the issue was that the command jupyter notebook changed to jupyter-notebook after installation.
If that doesn't work, try python -m notebook, and if it opens, close it, then
export PATH=$PATH:~/.local/bin/, then refresh your path by opening a new terminal, and try jupyter notebook again.
And finally, if that doesn't work, take a look at vim /usr/local/bin/jupyter-notebook, vim /usr/local/bin/jupyter, vim /usr/local/bin/jupyter-lab (if you have JupyterLab) and edit the #!python version at the top of the file to match the version of python you are trying to use. As an example, I installed Python 3.8.2 on my mac, but those files still had the path to the 3.6 version, so I edited it to #!/Library/Frameworks/Python.framework/Versions/3.8/bin/python3
Try this command: python -m IPython notebook
Credits to the GitHub user Milannju who provided the solution here.
This worked for me. (Python 3.6 on Ubuntu 18.04 LTS)
export PATH=$PATH:~/.local/bin/
On Ubuntu 18.10, the following command helped me out.
sudo apt-get install jupyter-notebook
Jupyter installation is not working on Mac Os
To run the jupyter notebook:-> python -m notebook
Use the command below and if you are using pip3 replace pip by pip3
pip install --upgrade --force-reinstall jupyter
This worked for me.
Since both pip and pip3.6 was installed and
pip install --upgrade --force-reinstall jupyter
was failing, so I used
pip3.6 install --upgrade --force-reinstall jupyter
and it worked for me.
Running jupyter notebook also worked after this installation.
Deactivate your virtual environment if you are currently in;
Run following commands:
python -m pip install jupyter
jupyter notebook
For me the fix was simply running pip install notebook
Somehow the original Jupiter install got borked along the way.
I'm trying to get this going on VirtualBox on Ubuntu. Finally on some other post it said to try jupyter-notebook. I tried this and it told me to do sudo apt-get jupyter-notebook and that installed a bunch of stuff. Now if I type command jupyter-notebook, it works.
If you are on Fedora installing python3-notebook resolved my problem.
# dnf install python3-notebook

Resources