Syllogism
Syllogism

Reputation: 184

Pandas will not import because of "dateutil.tz" inside git repo, runs fine outside

I've tried uninstalling and reinstalling Anaconda. and upgrading pandas and most other questions that ask this question. I am working with a brand new installation of Anaconda. with python 3.7, Why is pandas not importing normally?

I have tried manually installing pip install pytz --upgrade and pip install python-datutil --upgrade to no avail. However, After doing these two commands I can now import pandas in the terminal but not in my script where i need it.

The Script where i am trying to import pandas is inside a git repo that perhaps needs to be reconfigured. I suspect that might be the issue. but im not sure how to change how python interacts with pandas from within git.

Here is the stacktrace...

  File "C:\Users\jgreaves\Anaconda3\lib\site-packages\pandas\__init__.py", line 37, in <module>
    f"C extension: {module} not built. If you want to import "
ImportError: C extension: No module named 'dateutil.tz'; 'dateutil' is not a package not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.```








Here is the config of my virtual environment 

```# Name                    Version                   Build  Channel
ca-certificates           2020.1.1                      0    anaconda
certifi                   2020.4.5.2               py38_0    anaconda
numpy                     1.18.5                   pypi_0    pypi
openssl                   1.1.1g               he774522_0    anaconda
pandas                    1.0.4                    pypi_0    pypi
pip                       20.0.2                   py38_3    anaconda
pyodbc                    4.0.30                   pypi_0    pypi
python                    3.8.3                he1778fa_0    anaconda
python-dateutil           2.8.1                    pypi_0    pypi
pytz                      2020.1                   pypi_0    pypi
regex                     2020.6.8                 pypi_0    pypi
setuptools                47.1.1                   py38_0    anaconda
six                       1.15.0                   pypi_0    pypi
sqlite                    3.31.1               he774522_0    anaconda
vc                        14.1                 h0510ff6_4    anaconda
vs2015_runtime            14.16.27012          hf0eaf9b_2    anaconda
wheel                     0.34.2                   py38_0    anaconda
wincertstore              0.2                      py38_0    anaconda ```

Upvotes: 1

Views: 257

Answers (1)

Syllogism
Syllogism

Reputation: 184

So after having a friend of mine take a look at my directory. We discovered that I had a file in my working directory called "dateutil.py" which was supposed to be a module for my code that I very uncleverly named. This was what was causing the issue. I have since renamed the file and everything is working fine now.

Upvotes: 1

Related Questions