No module named 'pysolar' - even tough pysolar is installed - What am I doing wrong? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: No module named 'pysolar' - even tough pysolar is installed - What am I doing wrong? (/thread-33580.html) |
No module named 'pysolar' - even tough pysolar is installed - What am I doing wrong? - Jghurt - May-08-2021 Hello everyone :) I have the following problem: I have Python 3.8 installed and with anaconda3 i used the comand "pip3 install pysolar" to isntall pysolar (pysolar-0.9-py3-none-any.whl) When i now type "import pysolar" in a python script and I run it as a module, then the following error shows up: "ModuleNotFoundError: No module named 'pysolar'". I dont have a clue what I am doing wrong. I also didnt find an answer in the Internet. In the Internet its only written, that this error occurs, when pysolar is not installed. But i have it installed? When i go on anaconda3 again and type "pip3 install pysolar" I always get the message: "requirements already satisfied: pysolar in c:\users\xxx\anaconda3\lib\size-packages (0.9)" . So that means, it should be installed correctly? Does anyone have a clue or could help me to get pysolar work please :)? Thank you very much for you help already. RE: No module named 'pysolar' - even tough pysolar is installed - What am I doing wrong? - snippsat - May-08-2021 Make sure that (base) environment is active this is required in later version of Anaconda.If using Anaconda Prompt it is automatically activated. Here a quick run where i use cmder,so i activate myself has to same if just use cmd/poweshell. G:\Anaconda3 λ cd Scripts\ # Activate, see that now show (base) G:\Anaconda3\Scripts λ activate # Test pip,it will now always use pip form Anaconda # If i deactivate it will use my Python 3.9 pip (base) G:\Anaconda3 λ pip -V pip 20.0.2 from G:\Anaconda3\lib\site-packages\pip (python 3.7) # Install (base) G:\Anaconda3 λ pip3 install pysolar Collecting pysolar Downloading pysolar-0.9-py3-none-any.whl (46 kB) |████████████████████████████████| 46 kB 866 kB/s Installing collected packages: pysolar Successfully installed pysolar-0.9 # Test that it work (base) G:\Anaconda3 λ python Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from pysolar.solar import * >>> import datetime >>> >>> latitude = 42.206 >>> longitude = -71.382 >>> >>> date = datetime.datetime(2007, 2, 18, 15, 13, 1, 130320, tzinfo=datetime.timezone.utc) >>> print(get_altitude(latitude, longitude, date)) 30.914468243599078So if using it from a Editor eg VS Code that i use will use code . to start from command line so it find environment automatically or can manually choice it in Editor.
RE: No module named 'pysolar' - even tough pysolar is installed - What am I doing wrong? - Jghurt - May-08-2021 (May-08-2021, 04:01 PM)snippsat Wrote: Make sure that Thank you very much for your answer. As I had another problem with Anaconda, so I deinstalled it a couple of minutes ago. Is there a way to downlaod and use Pysolar with the normal Pyhton IDLE, without using anaconda or another program? If not, I will reinstall Anaconda and try the instructions you already wrote above. RE: No module named 'pysolar' - even tough pysolar is installed - What am I doing wrong? - Jghurt - May-08-2021 (May-08-2021, 02:39 PM)Jghurt Wrote: Hello everyone :) (May-08-2021, 04:01 PM)snippsat Wrote: Make sure that I did reinstall Anaconda to try your manual. In the cmd it all "worked". I got the following in the cmd: When I try that above written code in my normal python 3.8 IDLE i get the following error/output: When i went to the link on github.com I did try to install the mkl service and it updated to a newer version. When i type it in Anaconda again to install the mkl service, i get the message, that all requested packages are installed. I still get the above shown error. Also another problem that occurs now, that didn't occured, when i did not have anaconda installed:import pandas as pdImport pandas was working before i installed anaconda. I did not get any errors before. Since installing Anaconda again, i get the following errors again: Thats the reason, why I was asking, if there was another way to use Pysolar without using anaconda.. I am just getting problems here. Do you know a way to get Pysolar work with my normal IDLE ?*Edit: After uninstalling Anaconda again, the "import pandas as pd" is working again. Still no clue, how to get Pysolar work :( RE: No module named 'pysolar' - even tough pysolar is installed - What am I doing wrong? - snippsat - May-08-2021 (May-08-2021, 06:18 PM)Jghurt Wrote: Do you know a way to get Pysolar work with my normal IDLE ?Yes it work with version from python.org,and IDLE i never use only new people use it for while as it's not good at all.Want simple editor use Pyscripter or VS Cods evt Pychram for larger Editors. Python 3.9/3.8 and pip installation under Windows. VS Code from start. # Test pip C:\ λ pip -V pip 21.1 from c:\python39\lib\site-packages\pip (python 3.9) # Install C:\ λ pip install pysolar Collecting pysolar Using cached pysolar-0.9-py3-none-any.whl (46 kB) Installing collected packages: pysolar Successfully installed pysolar-0.9 # Test C:\ λ python Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from pysolar.solar import * >>> import datetime >>> >>> latitude = 42.206 >>> longitude = -71.382 >>> >>> date = datetime.datetime(2007, 2, 18, 15, 13, 1, 130320, tzinfo=datetime.timezone.utc) >>> print(get_altitude(latitude, longitude, date)) 30.914468243599078 >>> exit()Your error message show that you still mix stuff or (base) is not active. It start point to Anaconda then later down. * The Python version is: Python3.8 from "C:\Users\xxx\AppData\Local\Programs\Python\Python38\pythonw.exe" RE: No module named 'pysolar' - even tough pysolar is installed - What am I doing wrong? - Jghurt - May-08-2021 You are my king!! :) I think everything is working now. Thank you very very much! :) |