so my objective is to test a piechart from a code i found for visualizing stocks, kind of a portfolio. The problem is, that i always get an error. I tried using the jupyter notebook, which isnt as useful as I thougt. I am working with User Inputs. In the following are the libraries I used and the full code. Thanks in advance.
import datetime
import yfinance as yf
import plotly.graph_objects as go
https://github.com/NoamYakarOfficial/StockPortfolioVisualizer
it's working Vs code
can you check the python version or python extension install vs code,
after opening the terminal install packages
Can you run this way:
pip install yfinance
pip install plotly
Related
I'm having this bizarre experience; I'm re-running a code to plot a geographical graph using Plotly and use
import plotly.express as px
but it gives me the error message saying that "ModuleNotFoundError: No module named 'plotly.express'".
I can confirm that plotly is installed, and most importantly it was working until last night.
How come its suddenly not finding the module name while it was working until last night?
Has something been changed?
Any feedback much appreciated.
Apparently, it turned out that upgrading plotly version solved the problem.
To upgrade plotly, I simply run the following codes to check the plotly version.
import plotly
plotly.__version__
That gave me the output of version of plotly as '5.11.0'. Then I upgraded the plotly version to '5.11.0' by writing the following code:
pip install plotly==5.11.0
I have several imports in my current code:
from flask import Flask
import datetime as dt
import numpy as np
import pandas as pd
When I run this in VSCODE I am getting this error:
However, running this in jupyter notebook has no problems. When I looked online it said to use python interpreter but when I go to do that I get this error:
And another error:
Anaconda prompt says modules/packages are installed but when I run pip install in default windows terminal it says pip has no module:
Delete and reinstall Python extensions according to the same problem on github.
The second problem is related to the location of your Python interpreter. You need to choose the correct interpreter. I still recommend using one Python version in one environment. You can use other Python versions in virtual environment, so it won't lead to confusion.
I am trying to import plotly.express but I get the follow error:
AttributeError: module plotly.colors has no attribute named_colorscales
Code to import:
import plotly.graph_objects as go
import pandas as pd
import plotly.express as px
fig=go.Figure()
I have installed plotly express this morning using:
conda install -c plotly plotly_express
It appears to have been successfully installed without errors, but when I import it, the above error appears.
Kernel was restarted post installation.
EDIT: I have amended the code slightly as there was a slight error and an redundant import.
After a lot of work, it looks like the version of Plotly that I was using was out of date. I have upgraded that and it appears to have worked. Out of desperation, I decided to try upgrade plotly.express and it was out of date. After upgrade, worked like a charm.
I'm kind a new Python user - using Anaconda Python and VS code. I'm trying to launch my jupyter notebook, but I'm not able to import geopandas.
import geopandas
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import geopandas
ModuleNotFoundError: No module named 'geopandas'
I can see geopandas in 'conda list' in myenv, but still if I want to check it in my jupyter notebook I get negative response
import sys
'geopandas' in sys.modules
False
enter image description here
I already tried a lots of advices from here and git hub, but I'm not able to figure it out.
Am I missing something?
Thanks a lot for help!
Did you install the geopandas library before? If you don't do this before Please open your anaconda prompt form start menu and command the below lines
conda install -c conda-forge geopandas
and then press the enter button.
After that, You may apply below the line on your code
Update Code:
from geopy import geocoders # For matching the buildings' cities with time zones
from geopy.exc import GeocoderTimedOut # Catch timeouts while using Google geocoding API
from geopy.exc import GeocoderUnavailable # Catch other network problems
As long as you are sure that you can access the environment on jupyter,
What you have to do is to to manually install the packages.
Go to https://www.lfd.uci.edu/~gohlke/pythonlibs/, to download the compatible version for GDAL, Pyproj, Fiona, Shapely and Geopandas.
Then manually installed each using:
pip install the_file_path_to_the_downloaded_file
I hope this helps!
I ran into a similar problem with visual studio code. For me there is a button in the upper right corner of the VS Code window with the current environment selected. I clicked it and it allows me to change the kernel for the notebook :
This is assuming you have the dependencies installed.
I am working on project and getting this error
ImportError: No module named plotly.plotly
I tried:
pip install plotly
pip install --upgrade plotly
But import plotly.plotly as py didn't work.
Not sure if pyzo and python modules are stored at different location on your computer. And how they are referred.
But you can try following to give absolute path name for plotly while loading module and see if it works.
import sys
sys.path.insert(0, 'c:\\pyzo2015a\\lib\\site-packages\\plotly')
import plotly.plotly as py
I had the same exact problem, but the current answer did not resolve my issues. If that's the case, here is an alternative (IDE dependent):
I was not having success with the "pip" stuff. I am using PyCharm, and the following simple steps took care of my problems in less than 30 seconds.
Settings
Click Project: "MyProjectHere" in left hand nav menu
Select Project Interpreter from the above drop down
Find the green 'plus' sign near the upper right edge of the window
that comes up.
Type Plotly in the search bar
Click install.
Maybe one day I won't be a dumb monkey who doesn't know how to use a command line like all the cool kids, but for now this worked for me.
I had the same problem installing plotly with pip and then import not being able to find it, but it worked when I used conda, instead.