Python Forum
No module named 'pysolar' - even tough pysolar is installed - What am I doing wrong?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
No module named 'pysolar' - even tough pysolar is installed - What am I doing wrong?
#2
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.914468243599078
So 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.
Reply


Messages In This Thread
RE: No module named 'pysolar' - even tough pysolar is installed - What am I doing wrong? - by snippsat - May-08-2021, 04:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  no module named 'docx' when importing docx MaartenRo 1 977 Dec-31-2023, 11:21 AM
Last Post: deanhystad
  Problem with pymodbus - ModuleNotFoundError: No module named 'pymodbus.client.sync' stsxbel 2 24,071 Nov-02-2023, 08:20 AM
Last Post: South_east
  ModuleNotFoundError: No module named 'requests' Serg 18 2,751 Oct-29-2023, 11:33 PM
Last Post: Serg
  Resolving ImportError: No module named gdb (Python in C++) mandaxyz 3 1,519 Oct-04-2023, 02:43 PM
Last Post: mandaxyz
  ModuleNotFoundError: No module named 'PyPDF2' Benitta2525 1 1,602 Aug-07-2023, 05:32 AM
Last Post: DPaul
  ModuleNotFoundError: No module named 'eyed3' Wimpy_Wellington 2 1,391 Jul-10-2023, 03:37 AM
Last Post: Wimpy_Wellington
  How to fix this error: ModuleNotFoundError: No module named 'notears' yaoyao22 2 1,072 Jul-09-2023, 11:24 AM
Last Post: yaoyao22
  Help with pyinstaller "No module named" korenron 9 9,407 Jun-15-2023, 12:20 PM
Last Post: snippsat
  Problem with Pyinstaller. No module named '_tkinter' tonynapoli2309 0 1,049 May-15-2023, 02:38 PM
Last Post: tonynapoli2309
  Am I wrong or is Udemy wrong? String Slicing! Mavoz 3 2,646 Nov-05-2022, 11:33 AM
Last Post: Mavoz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020