-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ModuleNotFoundError: No module named 'sympy' #4716
Comments
I resolved this by running the following from Python: import sys and then copying the paths as a list into my qmd and adding: import sys for path in paths: so then it knew where to look for the package |
I'm glad that solved the problem for you, but it means that your setup from |
Thanks. This is my output. (venv) (base) C:\Users\abiga\OneDrive\Documents\PythonScripts\linear_equations\qmd>quarto check [>] Checking Quarto installation......OK [>] Checking basic markdown render....OK [>] Checking Python 3 installation....OK [>] Checking Jupyter engine render....OK [>] Checking R installation...........OK |
My setup is pretty bad right now in terms of having multiple versions of Python installed. It was my hope that by using a virtual environment that would not matter. |
Two things:
I suspect you'll see different results. If that's the case, then what you need to do, then, is remove C:/Users/abiga/anaconda3/python.exe from your PATH, so that the "good" version of Python is the one we see.
This is actually true, but you need to make sure that the virtual environment is active before running quarto (we have no way to see which virtual environment you mean, and we use whatever the shell tells us) |
Thank you.
|
[>] Checking Quarto installation......OK [>] Checking basic markdown render....OK [>] Checking Python 3 installation....OK () Checking Jupyter engine render....0.00s - Debugger warning: It seems that frozen modules are being used, which may 2023-03-09 00:11:00,153 - traitlets - ERROR - [WinError 2] The system cannot find the file specified [WinError 2] The system cannot find the file specified |
@cderv Do you have experience with Python installs on windows that might be able to help here? |
ouch this seems to be a nasty bug somewhere... I have some solutions on how to manage environment but first, if you agree I would like to understand better your setup. From the log you shared, it seems related to Windows python.exe defaulting to installing a python from Windows Store (don't know why they did that really). But s you installed a python version from Python.prg I am surprised it is not using that, and that we see this one in log
Did you select First question: Do you know install python from the windows store ? If you don't know, you can probably check from the windows store, or we'll know from the following. To confirm this, can you run for me in a Powershell terminal
You can do that from a normal terminal, and one with the virtualenv you want to use, if any. Checking the PATH could also get us some hint on what is available $env:PATH -Split ";" Thanks |
Thanks.
So that's different! py -0p
this is path:
|
[>] Checking Quarto installation......OK [>] Checking basic markdown render....OK ERROR: The file cannot be accessed by the system. (os error 1920), stat 'C:\Users\abiga\AppData\Local\Microsoft\WindowsApps\python.exe' When I take that out of my environmental variable I instead get: Unable to locate an installed version of Python 3. |
(I'm just adding some additional information to make @cderv's job easier when he sees this) Inspecting the difference between
and
Makes me think that something, somewhere, is getting confused about subdirectories, and that long The only place where we check for QUARTO_PYTHON is in
|
Thanks @abigailhaddad and @cscheid ! @abigailhaddad sorry for not having thought about that, but the path is of interest in gcm python3 | Format-List -Property Name, Definition, Path
gcm python | Format-List -Property Name, Definition, Path I believe the issue we encounter here is with Some context about Microsoft store version
Personally, I would not use this version. Your installed python.org versions seemed ok. One thing that could mess things up is the Windows alias that are supposed to be helping user; If you don't have Python installed, So you could also try this
Quarto should find Python correctly. For 1.4, I'll definitely try to check all those scenarios to check we handle correctly - I am under the impression that the Windows Store version python does not work well with Quarto.
This is the folder name that Windows App installed get usually so not unusual but maybe our code does not handle correctly. 🤔 |
$ gcm python | Format-List -Property Name, Definition, Path
Name : python.exe
Definition : C:\\Users\\abiga\\AppData\\Local\\Programs\\Python\\Python311\python.exe
Path : C:\\Users\\abiga\\AppData\\Local\\Programs\\Python\\Python311\python.exe
$ gcm python3 | Format-List -Property Name, Definition, Path
gcm : The term 'python3' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ gcm python3 | Format-List -Property Name, Definition, Path
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (python3:String) [Get-Command], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand 4. quarto check
|
I copied my python.exe file to where it was looking for a python.exe file I now get this:
But then when I run quarto, it can't find any of my libraries, because the executable it's now using is which I can tell because I made a qmd file that just prints out where the executable is:
|
First, I took the liberty to reformat your code as code so that it is easier to read.
Now I don't understand why
Not a good solution to do that, usually executable file are expecting resource to be relative to the exe file, so that is why it doesn't work after. Even if it worked, I wouldn't trust the setup. I think your close to debug your setup - we need to check configuration jupyter kernelspec list Should show which Also I don't think having it is just that |
Thank you.
jupyter : The term 'jupyter' is not recognized as the name of a cmdlet, function, script file, or operable program. 'jupyter' is not recognized as an internal or external command,
I looked for where a jupyter.exe file might be and I found various .exe files which begin "jupyter" in here: "C:\Users\abiga\AppData\Local\Programs\Python\Python311\Scripts\jupyter-lab.exe", but not one that's just "juypter.exe" |
Also - potentially unrelated (or at least not fixed in even an ad hoc way by appending sys.paths), I'm having issues with plotly - two separate ones having to do with not writing out figures to .docx or .pdf files (but writing them out to html), and then not being able to save a figure to .png (or other file formats) at all. Should I make another issue for that or assume it might be related to this, or just wait? Thanks. |
This is definitely a configuration issue. Something in your Python configuration is messing up the path, and you manage to make it work by fixing at the higher level within document. I would try to find this python kernel spec. It is in a
This is surprising that is works ok without it. It seems you have jupyter-lab and not jupyter itself. Regarding jupyter command, it is made available when you install The exe should be available has a command as long as you have the Scripts folder in your PATH. The This should be part of the setup from your Python installation. |
|
It was putting jupyter.exe here: C:\Users\abiga\AppData\Roaming\Python\Python311\Scripts; adding that to my environment |
Different error message now:
|
This files should contain the info shown usually with
I don't know why now you have a very short path for installation. Sorry for all this trouble and (unsucessful) help to debug all this. I am thinking everything gets mixed up maybe after all the tries. I am still available to help you as most as I can. The idea behind looking in this Anyway, regarding Python install, usually our recommended way is
We plan to update this with more information, and also better support Pyenv users. |
@abigailhaddad Is this now ok ? Can we close this issue ? |
Thanks. I didn't get it working, but we can close it. At this point, I would just hard-code amending the paths of my libraries to use this. |
This does not seem right to me. Please follow #4737 so that we can revisit all this when this is ready. We should really make the experience better - we can't be satisfied by a hard-coded workaround. The experience should be smoother. So please come back to us again with this and see you around in #4737 thanks |
I have the same issue. Do you have further suggestion? |
Which issue ? This thread have several issues found along the investigation, and quite specific to @abigailhaddad set up from what we understood. @AlexSantopaolo can you open a new issue explaining your setup and what issue you encounter ? Please test with Quarto 1.3 Thank you |
Hi. I'm having the same ModuleNotFoundError: No module named 'sympy' error, even though it's installed. I'm trying to run my code in Visual studio, here are some details: and jupyter kernelspec list |
I never exactly resolved this, but the workaround of adding the locations
of my packages - hard-coding those - did work.
…On Tue, May 9, 2023, 5:16 AM Maripash ***@***.***> wrote:
Hi. I'm having the same ModuleNotFoundError: No module named 'sympy'
error, even though it's installed. I'm trying to run my code in Visual
studio, here are some details:
pip show sympy
Name: sympy
Version: 1.10.1
Summary: Computer algebra system (CAS) in Python
Home-page: https://sympy.org
Author: SymPy development team
Author-email: ***@***.***
License: BSD
Location:
c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages
Requires: mpmath
Required-by: pydy
and
jupyter kernelspec list
Available kernels:
%s %s python3 C:\Python310\share\jupyter\kernels\python3
—
Reply to this email directly, view it on GitHub
<#4716 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AECVNW6QAGJDHNBESNVEL6TXFIDNHANCNFSM6AAAAAAVUNPHJE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I have solved it! |
I have found an article that suggested to run the following commands, maybe one if them will help you: pip install sympy 👇️ for Python 3pip3 install sympy 👇️ if you don't have pip in your PATH environment variablepython -m pip install sympy 👇️ for Python 3python3 -m pip install sympy 👇️ using py aliaspy -m pip install sympy 👇️ if you get permissions errorpip install sympy --user 👇️ for Anacondaconda install -c anaconda sympy |
I had SymPy installed, which is why it was working to hard code the
locations of the packages - because it was there, it just wasn't getting
found. Did you find that installing with py made quarto find the package,
even though you'd previously installed it with pip or in some other way?
…On Tue, May 9, 2023, 8:16 AM Maripash ***@***.***> wrote:
I never exactly resolved this, but the workaround of adding the locations
of my packages - hard-coding those - did work.
… <#m_-1315262881479159798_>
On Tue, May 9, 2023, 5:16 AM Maripash *@*.*> wrote: Hi. I'm having the
same ModuleNotFoundError: No module named 'sympy' error, even though it's
installed. I'm trying to run my code in Visual studio, here are some
details: pip show sympy Name: sympy Version: 1.10.1 Summary: Computer
algebra system (CAS) in Python Home-page: https://sympy.org
<https://sympy.org> Author: SymPy development team Author-email: @.*
License: BSD Location:
c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages
Requires: mpmath Required-by: pydy and jupyter kernelspec list Available
kernels: %s %s python3 C:\Python310\share\jupyter\kernels\python3 — Reply
to this email directly, view it on GitHub <#4716 (comment)
<#4716 (comment)>>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AECVNW6QAGJDHNBESNVEL6TXFIDNHANCNFSM6AAAAAAVUNPHJE
. You are receiving this because you were mentioned.Message ID: *@*.***>
I have found an article that suggested to run the following commands,
maybe one if them will help you:
pip install sympy
👇️ for Python 3
pip3 install sympy
👇️ if you don't have pip in your PATH environment variable
python -m pip install sympy
👇️ for Python 3
python3 -m pip install sympy
👇️ using py alias
py -m pip install sympy
👇️ if you get permissions error
pip install sympy --user
👇️ for Anaconda
conda install -c anaconda sympy
—
Reply to this email directly, view it on GitHub
<#4716 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AECVNW2TQIVYRWXUOMJKVTTXFIYS3ANCNFSM6AAAAAAVUNPHJE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Yes! I also had my sympy installed, but for some reason when I was trying to run a code, I was having an error saying that it is not installed. So I installed it again using "python3 -m pip install sympy" and it worked. Basically, I've just went through all commands I've send in previous message |
Bug description
This is the code -- full qmd below
This is the error message:
ModuleNotFoundError: No module named 'sympy'
Sympy is installed in my virtual environment. When I start Python from my virtual environment and I run the code snippet, it runs.
I have tried doing !pip install sympy and !pip3 install sympy from within the code snipped and it runs but does not change the error message.
Whether I try to render as a docx, PDF, or word document does not change the outcome.
This is the full QMD that gets me the error message. I have also tried adding pip install sympy and pip3 install sympy from the code snippet and it runs but does not affect the error message
title: "Solving A Linear Equation Two Ways In Python"
author: "Abigail Haddad"
date: "March 08, 2023"
I am running this on Windows from a virtual environment. I am not using RStudio.
Checklist
The text was updated successfully, but these errors were encountered: