how do I install mysql on anaconda with this: Solving environment - mysql-connector

I'm a newbie when it has to do with installing packages through the cmd and would appreciate your help
I'm trying to install mysql-connector to my anaconda environment with this command:
conda install -c anaconda mysql-connector-python
and I get the following error:
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
I tried to the solutions suggested in this post but nothing works:
Conda install and update do not work also solving environment get errors
(meaning I tried creating another environment, than installing and also tried to run this
conda config --set channel_priority false but to no vail).
My conda version is the lastest - conda 4.10.1
here is the info for my conda
active environment : base
active env location : C:\Users\admin\anaconda3
shell level : 1
user config file : C:\Users\admin\.condarc
populated config files : C:\Users\admin\.condarc
conda version : 4.10.1
conda-build version : 3.21.4
python version : 3.8.8.final.0
virtual packages : __win=0=0
__archspec=1=x86_64
base environment : C:\Users\admin\anaconda3 (writable)
conda av data dir : C:\Users\admin\anaconda3\etc\conda
conda av metadata url : https://repo.anaconda.com/pkgs/main
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Users\admin\anaconda3\pkgs
C:\Users\admin\.conda\pkgs
C:\Users\admin\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\admin\anaconda3\envs
C:\Users\admin\.conda\envs
C:\Users\admin\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.10.1 requests/2.25.1 CPython/3.8.8 Windows/10 Windows/10.0.19041
administrator : False
netrc file : None
offline mode : False
Appreciate your help

Found the issue
The problem was my python version 3.8, which does not support mysql-connector
Once I downgraded to 3.7.10 it worked perfectly fine

Related

Jupyter not found when checked with quarto in Mac

I installed the Jupyter with brew, and when I type
jupyter --version
I got the following
IPython : 8.8.0
ipykernel : 6.16.0
ipywidgets : not installed
jupyter_client : 7.3.5
jupyter_core : 4.11.1
jupyter_server : 1.19.1
jupyterlab : 3.4.8
nbclient : 0.6.8
nbconvert : 7.1.0
nbformat : 5.6.1
notebook : 6.4.12
qtconsole : not installed
traitlets : 5.8.0
But when I checked the Jupyter with quarto:
quarto check jupyter
I got the following
[✓] Checking Python 3 installation....OK
Version: 3.9.6
Path: /Library/Developer/CommandLineTools/usr/bin/python3
Jupyter: (None)
Jupyter is not available in this Python installation.
Install with python3 -m pip install jupyter
It seems that the Jupyter installed via brew could not be found by the quarto.
Is there a way to fix this with out reinstalling the Jupyter with pip?
Thanks

Getting the error PackageNotFound whenever iam trying to install something using conda

i am trying to create a new env with python 3.6 using conda. i have installed miniforge3 and anaconda. i have tried some the solutions but nothing worked for me.
The error i am getting everytime.
`
(base) hassaanzahid#Hassaans-MacBook-Pro tensorflow-test % conda create --prefix ./env python=3.8
conda activate ./env
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- python=3.8
Current channels:
- https://conda.anaconda.org/conda-forge/noarch
- https://conda.anaconda.org/conda-forge/osx-arm64
- https://conda.anaconda.org/co/osx-arm64
- https://conda.anaconda.org/co/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
EnvironmentLocationNotFound: Not a conda environment: /Users/hassaanzahid/tensorflow-test/env
`
I have tried some of the solutions provided online but none of these worked for me
Solutions i have tried.
conda clean -all
conda clean --index-cache
conda update conda
conda config --append channels conda-forge
conda config --set offline false
i have tried all these command but none of these worked for me.

Visual Studio Code does not render ipywidgets correctly

I am having issue using Visual Studio Code. the code seem to have issue with ipywidgets.
the code is below (very simple interactive chart)
from ipywidgets import interact
import ipywidgets as widgets
import numpy as np
import plotly.graph_objects as go
#interact
def foo(beta=(-10,10,1)):
myx = np.arange(0,100,1)
myy = myx *beta
print ('debug:',myy)
fig = go.FigureWidget()
fig.add_scatter(x= myx, y=myy)
fig.show()
the same code works just as expected in Jupyter Notebook.
I dig further and it seems:
"widgets require us to download supporting files from a 3rd party website. Error loading plotlywidget: ^4.14.3
https://github.com/microsoft/vscode-jupyter/wiki/IPyWidget-Support-in-VS-Code-Python
This is where I got stuck.. What's the next then to fix this issue?
any guidance much appreciated
thanks
Some of the issues I've seen reported seem to have started after the release of ipywidgets 8.
I don't understand exactly what's broken (or if it's broken), but downgrading to version 7.7.1 fixed all issues I was having.
If you want to try it as well, you can run: pip install -U ipywidgets==7.7.1
There two things you can explore.
Check modules:
Run the jupyter --version command inside your conda or virtual environment.
You should see something like this:
IPython : 8.4.0
ipykernel : 6.9.1
ipywidgets : 7.7.1
jupyter_client : 7.2.2
jupyter_core : 4.10.0
jupyter_server : 1.21.0
jupyterlab : 3.4.8
nbclient : 0.6.4
nbconvert : 6.5.0
nbformat : 5.4.0
notebook : 6.4.12
qtconsole : not installed
traitlets : 5.4.0
If there are any of those modules not installed (Apart from qtconsole) try installing them (with pip install "module") and restarting the kernel.
Check Jupyter nbextension.
As mentioned here after running pip install ipywidgets try:
jupyter nbextension enable --py widgetsnbextension
Note: If you are using virtual environments (including conda environments) the recommended way to activate the extension is to run
jupyter nbextension enable --py --sys-prefix widgetsnbextension
I hope this helps.

jupyter ImportError: cannot import name 'constants' from partially initialized module 'zmq.backend.cython'

I recently upgraded jupyter, but now I get
ImportError: cannot import name 'constants' from partially initialized module 'zmq.backend.cython'
when I run for instance jupyter-notebook or jupyter notebook
and pip install --upgrade pyzmq did not solve the issue
any idea?
Thanks
ps: I am on Mac OS 10.15.5 , with jupyter --v:
jupyter core : 4.6.3
jupyter-notebook : 6.0.3
qtconsole : 4.5.5
ipython : 8.0.0.dev
ipykernel : not installed
jupyter client : not installed
jupyter lab : 1.2.3
nbconvert : 5.6.1
ipywidgets : not installed
nbformat : 5.0.4
traitlets : 4.3.3
I had the same issue and below fixed my problem:
pip uninstall pyzmq
pip install pyzmq
This actually worked. If you are launching jupyter-notebook from a venv and you get this error message, just pip unistall pyzmg and pip install pyzmg. You should be fine.

Conda virtual environment for IPython

I'm fairly new to the Python scene. My problem is that when I launch a jupyter notebook from an Anaconda Powershell with my DataScience virtual environment activated, the notebook does not have my virtual environment in it's PATH, and therefore cannot find some packages (like plotly and progress). The same is true when I launch VS Code from Anaconda Navigator with DataScience activated. When I run import plotly in an interactive window, I get ModuleNotFoundError: No module named ‘plotly’. But when I run this line in the terminal within VS Code, it runs without error.
So I have run the following commands in various shell/terminal sessions:
import sys
print(sys.path)
In a VS Code terminal I get:
['', 'C:\\Users\\adiad\\Anaconda3\\envs\\DataScience\\python37.zip', 'C:\\Users\\adiad\\Anaconda3\\envs\\DataScience\\DLLs', 'C:\\Users\\adiad\\Anaconda3\\envs\\DataScience\\lib', 'C:\\Users\\adiad\\Anaconda3\\envs\\DataScience', 'C:\\Users\\adiad\\Anaconda3\\envs\\DataScience\\lib\\site-packages']
In an interactive window in VS Code I get:
['C:\\Users\\adiad\\AppData\\Local\\Temp\\04e2b30c-4fc3-4aa9-9567-3aba17081a73', 'C:\\Users\\adiad\\Anaconda3\\python37.zip', 'C:\\Users\\adiad\\Anaconda3\\DLLs', 'C:\\Users\\adiad\\Anaconda3\\lib', 'C:\\Users\\adiad\\Anaconda3', '', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\win32', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\win32\\lib', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\Pythonwin', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\IPython\\extensions', 'C:\\Users\\adiad\\.ipython']
In a jupyter notebook running in my browser I get:
['C:\\Users\\adiad\\Anaconda3\\envs\\test', 'C:\\Users\\adiad\\Anaconda3\\python37.zip', 'C:\\Users\\adiad\\Anaconda3\\DLLs', 'C:\\Users\\adiad\\Anaconda3\\lib', 'C:\\Users\\adiad\\Anaconda3', '', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\win32', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\win32\\lib', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\Pythonwin', 'C:\\Users\\adiad\\Anaconda3\\lib\\site-packages\\IPython\\extensions', 'C:\\Users\\adiad\\.ipython']
The IPython session don't appear to reference my virtual environment. So my question is: what do I need to do make IPython run with same environment as my terminal?
I found the following SO question which seems to answer my question, but I find it hard to believe that everyone is following this practice.
How to start an ipython shell(not notebook) within a conda or virtualenv
Here's my configuration:
conda version : 4.7.12
conda-build version : 3.18.8
python version : 3.7.3.final.0
virtual packages :
base environment : C:\Users\adiad\Anaconda3 (writable)
channel URLs : https://conda.anaconda.org/conda-forge/win-64
https://conda.anaconda.org/conda-forge/noarch
https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Users\adiad\Anaconda3\pkgs
C:\Users\adiad\.conda\pkgs
C:\Users\adiad\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\adiad\Anaconda3\envs
C:\Users\adiad\.conda\envs
C:\Users\adiad\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.7.12 requests/2.22.0 CPython/3.7.3 Windows/10 Windows/10.0.18362
After doing further digging, my problem ought to be filed under, "knowing enough to be dangerous." My problem was ultimately caused by the fact that the jupyter package hadn't yet been installed in my new environment. So whenever I attempted to launch an IPython session of some kind, either in VS Code or in a browser, the application would look in my environment and see that the IPython packages weren't installed. It would then look to other conda environments and use the "nearest" equivalent, which was the base environment. Hence, most of the packages would load, but not all.
The fix to my problem was:
conda install jupyter
Another simple fix:
Launch CMD.exe prompt on Anaconda Navigator
Install: conda install jupyter
And
Conda install plotly