Tuesday, 24 July 2018

conda virtual environment not working with pycharm

i have a script gapminder1.py which uses the panda and sklern.

# TODO: Add import statements

import pandas as pd

from sklearn.linear_model import LinearRegression


# Assign the dataframe to this variable.
# TODO: Load the data
bmi_life_data = pd.read_csv("CSV_DATA/bmi_and_life_expectancy.csv")
print(bmi_life_data)
# Make and fit the linear regression model
#TODO: Fit the model and Assign it to bmi_life_model
bmi_life_model = LinearRegression()
bmi_life_model.fit(bmi_life_data[['BMI']], bmi_life_data[['Life expectancy']])
# Make a prediction using the model
# TODO: Predict life expectancy for a BMI value of 21.07931
laos_life_exp = bmi_life_model.predict(21.07931)

i am running the script from cmd console which is working fine but the same script from pycharm showing me the error

C:\Users\tripathi\AppData\Local\Continuum\anaconda3\envs\dsnd\python.exe C:/Users/tripathi/PycharmProjects/dsnd/gapminder1.py
Traceback (most recent call last):
  File "C:/Users/tripathi/PycharmProjects/dsnd/gapminder1.py", line 3, in <module>
    import pandas as pd
  File "C:\Users\tripathi\AppData\Local\Continuum\anaconda3\envs\dsnd\lib\site-packages\pandas\__init__.py", line 19, in <module>
    "Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']

i am using same conda environment on both the places but not sure why it is not working fine.



from conda virtual environment not working with pycharm

No comments:

Post a Comment