Closed markgahagan1 closed 1 year ago
Hi, I have no idea what's the real issue here (maybe Windows or the python context manager doesn't work properly) . For some reason windows doesn't allow the folder to be moved from the temporary directory to the final location.
I have seen it happen once on a windows machine installation, but unfortunately can't replicate it, as I don't have a windows machine at hand.
Also the error
conn = txn.connect() AttributeError: 'Connection' object has no attribute 'connect'
is quite suspicious.
I can only suggest to maybe try to use a python 3.9 environment to see if the error persists. Or, if there is data under the temporary norgatedata-fang\2023-02-19T11;02;14.903658 to simply move it you the zipline/data folder
Cheers, MBounouar
Thanks for coming back to me. I tried completely uninstalling anaconda, installing miniconda and creating a python 3.9 environment. I then refollowed the instructions to install zipline reloaded and zipline norgatedata. Unfortunately exactly the same error occurs under 3.9. As you suggested there is data in the Temp folder which is not being moved to the correct folder. So the issue is somewhere in between the two operations.
Further update. You were right on the connection error being suspicious. I saw that had been reported before on here so i did as instructed in that solution: pip install sqlalchemy<2. It worked. Thanks for your help.
I suspected SQLAlchemy version early on, but I didn't mention it explicitly because I assumed from the packages versions extract shown that it was "sqlalchemy 1.4.39".
Feel free to close the issue if you think it's solved.
Dear Zipline Maintainers,
Before I tell you about my issue, let me describe my environment:
msys2-conda-epoch 20160418 1 multipledispatch 0.6.0 py39haa95532_0 munkres 1.1.4 py_0 mypy_extensions 0.4.3 py39haa95532_1 navigator-updater 0.2.1 py39_1 nbclassic 0.4.8 py39haa95532_0 nbclient 0.5.13 py39haa95532_0 nbconvert 6.5.4 py39haa95532_0 nbformat 5.7.0 py39haa95532_0 nest-asyncio 1.5.6 py39haa95532_0 networkx 2.8.4 py39haa95532_0 nltk 3.7 pyhd3eb1b0_0 nose 1.3.7 pyhd3eb1b0_1008 notebook 6.5.2 py39haa95532_0 notebook-shim 0.2.2 py39haa95532_0 numba 0.56.4 py39hf11a4ad_0 numexpr 2.8.4 py39h5b0cc5e_0 numpy 1.23.5 py39h3b20f71_0 numpy-base 1.23.5 py39h4da318b_0 numpydoc 1.5.0 py39haa95532_0 olefile 0.46 pyhd3eb1b0_0 openjpeg 2.4.0 h4fc8c34_0 openpyxl 3.0.10 py39h2bbff1b_0 openssl 3.0.8 hcfcfb64_0 conda-forge packaging 22.0 py39haa95532_0 pandas 1.5.2 py39hf11a4ad_0 pandocfilters 1.5.0 pyhd3eb1b0_0 panel 0.14.3 py39haa95532_0 param 1.12.3 py39haa95532_0 paramiko 2.8.1 pyhd3eb1b0_0 parsel 1.6.0 py39haa95532_0 parso 0.8.3 pyhd3eb1b0_0 partd 1.2.0 pyhd3eb1b0_1 pathlib 1.0.1 pyhd3eb1b0_1 pathspec 0.10.3 py39haa95532_0 patsy 0.5.3 py39haa95532_0 pcre2 10.40 h17e33f8_0 conda-forge pep8 1.7.1 py39haa95532_1 pexpect 4.8.0 pyhd3eb1b0_3 pickleshare 0.7.5 pyhd3eb1b0_1003 pillow 9.3.0 py39hd77b12b_2 pip 22.3.1 py39haa95532_0 pkginfo 1.8.3 py39haa95532_0 platformdirs 2.5.2 py39haa95532_0 plotly 5.9.0 py39haa95532_0 pluggy 1.0.0 py39haa95532_1 ply 3.11 py39haa95532_0 pooch 1.4.0 pyhd3eb1b0_0 powershell_shortcut 0.0.1 3 poyo 0.5.0 pyhd3eb1b0_0 prometheus_client 0.14.1 py39haa95532_0 prompt-toolkit 3.0.36 py39haa95532_0 prompt_toolkit 3.0.36 hd3eb1b0_0 protego 0.1.16 py_0 psutil 5.9.0 py39h2bbff1b_0 ptyprocess 0.7.0 pyhd3eb1b0_2 py 1.11.0 pyhd3eb1b0_0 py-lief 0.12.3 py39hd77b12b_0 pyasn1 0.4.8 pyhd3eb1b0_0 pyasn1-modules 0.2.8 py_0 pybind11-abi 4 hd3eb1b0_0 pycodestyle 2.8.0 pyhd3eb1b0_0 pycosat 0.6.4 py39h2bbff1b_0 pycparser 2.21 pyhd3eb1b0_0 pyct 0.5.0 py39haa95532_0 pycurl 7.45.1 py39hcd4344a_0 pydispatcher 2.0.5 py39haa95532_2 pydocstyle 6.3.0 py39haa95532_0 pyerfa 2.0.0 py39h2bbff1b_0 pyflakes 2.4.0 pyhd3eb1b0_0 pygments 2.11.2 pyhd3eb1b0_0 pyhamcrest 2.0.2 pyhd3eb1b0_2 pyjwt 2.4.0 py39haa95532_0 pylint 2.14.5 py39haa95532_0 pyls-spyder 0.4.0 pyhd3eb1b0_0 pynacl 1.5.0 py39h8cc25b3_0 pyodbc 4.0.34 py39hd77b12b_0 pyopenssl 22.0.0 pyhd3eb1b0_0 pyparsing 3.0.9 py39haa95532_0 pyqt 5.15.7 py39hb08f45d_0 conda-forge pyqt5-sip 12.11.0 py39h415ef7b_0 conda-forge pyqtwebengine 5.15.7 py39hb08f45d_0 conda-forge pyrsistent 0.18.0 py39h196d8e1_0 pysocks 1.7.1 py39haa95532_0 pytables 3.7.0 py39h388bc9b_1 pytest 7.1.2 py39haa95532_0 python 3.9.16 h4de0772_0_cpython conda-forge python-dateutil 2.8.2 pyhd3eb1b0_0 python-fastjsonschema 2.16.2 py39haa95532_0 python-libarchive-c 2.9 pyhd3eb1b0_1 python-lsp-black 1.2.1 py39haa95532_0 python-lsp-jsonrpc 1.0.0 pyhd3eb1b0_0 python-lsp-server 1.5.0 py39haa95532_0 python-slugify 5.0.2 pyhd3eb1b0_0 python-snappy 0.6.1 py39hd77b12b_0 python_abi 3.9 2_cp39 conda-forge pytoolconfig 1.2.5 py39haa95532_1 pytz 2022.7 py39haa95532_0 pyviz_comms 2.0.2 pyhd3eb1b0_0 pywavelets 1.4.1 py39h2bbff1b_0 pywin32 305 py39h2bbff1b_0 pywin32-ctypes 0.2.0 py39haa95532_1000 pywinpty 2.0.2 py39h5da7b33_0 pyyaml 6.0 py39h2bbff1b_1 pyzmq 23.2.0 py39hd77b12b_0 qdarkstyle 3.0.2 pyhd3eb1b0_0 qstylizer 0.2.2 py39haa95532_0 qt 5.15.6 h91493d7_0 conda-forge qt-main 5.15.6 h9580fe5_6 conda-forge qt-webengine 5.15.4 h0bdee70_3 conda-forge qtawesome 1.2.2 py39haa95532_0 qtconsole 5.3.2 py39haa95532_0 qtpy 2.2.0 py39haa95532_0 queuelib 1.5.0 py39haa95532_0 regex 2022.7.9 py39h2bbff1b_0 reproc 14.2.4 hd77b12b_1 reproc-cpp 14.2.4 hd77b12b_1 requests 2.28.1 py39haa95532_0 requests-file 1.5.1 pyhd3eb1b0_0 ripgrep 13.0.0 haa95532_0 rope 1.7.0 py39haa95532_0 rtree 1.0.1 py39h2eaa2aa_0 ruamel.yaml 0.17.21 py39h2bbff1b_0 ruamel.yaml.clib 0.2.6 py39h2bbff1b_1 ruamel_yaml 0.17.21 py39h2bbff1b_0 s3transfer 0.6.0 py39haa95532_0 scikit-image 0.19.3 py39hd77b12b_1 scikit-learn 1.0.2 py39hf11a4ad_1 scikit-learn-intelex 2021.6.0 py39haa95532_0 scipy 1.10.0 py39h321e85e_0 scrapy 2.6.2 py39haa95532_0 seaborn 0.12.2 py39haa95532_0 send2trash 1.8.0 pyhd3eb1b0_1 service_identity 18.1.0 pyhd3eb1b0_1 setuptools 65.6.3 py39haa95532_0 sip 6.6.2 py39hd77b12b_0 six 1.16.0 pyhd3eb1b0_1 smart_open 5.2.1 py39haa95532_0 snappy 1.1.9 h6c2663c_0 sniffio 1.2.0 py39haa95532_1 snowballstemmer 2.2.0 pyhd3eb1b0_0 sortedcollections 2.1.0 pyhd3eb1b0_0 sortedcontainers 2.4.0 pyhd3eb1b0_0 soupsieve 2.3.2.post1 py39haa95532_0 sphinx 5.0.2 py39haa95532_0 sphinxcontrib-applehelp 1.0.2 pyhd3eb1b0_0 sphinxcontrib-devhelp 1.0.2 pyhd3eb1b0_0 sphinxcontrib-htmlhelp 2.0.0 pyhd3eb1b0_0 sphinxcontrib-jsmath 1.0.1 pyhd3eb1b0_0 sphinxcontrib-qthelp 1.0.3 pyhd3eb1b0_0 sphinxcontrib-serializinghtml 1.1.5 pyhd3eb1b0_0 spyder 5.3.3 py39hcbf5309_0 conda-forge spyder-kernels 2.3.3 py39haa95532_0 sqlalchemy 1.4.39 py39h2bbff1b_0 statsmodels 0.13.5 py39h080aedc_1 sympy 1.11.1 py39haa95532_0 tabulate 0.8.10 py39haa95532_0 tbb 2021.6.0 h59b6b97_1 tbb4py 2021.6.0 py39h59b6b97_1 tblib 1.7.0 pyhd3eb1b0_0 tenacity 8.0.1 py39haa95532_1 terminado 0.17.1 py39haa95532_0 testpath 0.6.0 py39haa95532_0 text-unidecode 1.3 pyhd3eb1b0_0 textdistance 4.2.1 pyhd3eb1b0_0 threadpoolctl 2.2.0 pyh0d69192_0 three-merge 0.1.1 pyhd3eb1b0_0 tifffile 2021.7.2 pyhd3eb1b0_2 tinycss2 1.2.1 py39haa95532_0 tk 8.6.12 h2bbff1b_0 tldextract 3.2.0 pyhd3eb1b0_0 toml 0.10.2 pyhd3eb1b0_0 tomli 2.0.1 py39haa95532_0 tomlkit 0.11.1 py39haa95532_0 toolz 0.12.0 py39haa95532_0 tornado 6.2 py39h2bbff1b_0 tqdm 4.64.1 py39haa95532_0 traitlets 5.7.1 py39haa95532_0 twisted 22.2.0 py39h2bbff1b_1 twisted-iocpsupport 1.0.2 py39h2bbff1b_0 typing-extensions 4.4.0 py39haa95532_0 typing_extensions 4.4.0 py39haa95532_0 tzdata 2022g h04d1e81_0 ucrt 10.0.20348.0 haa95532_0 ujson 5.4.0 py39hd77b12b_0 unidecode 1.2.0 pyhd3eb1b0_0 urllib3 1.26.14 py39haa95532_0 vc 14.2 h21ff451_1 vs2015_runtime 14.34.31931 h4c5c07a_10 conda-forge w3lib 1.21.0 pyhd3eb1b0_0 watchdog 2.1.6 py39haa95532_0 wcwidth 0.2.5 pyhd3eb1b0_0 webencodings 0.5.1 py39haa95532_1 websocket-client 0.58.0 py39haa95532_4 werkzeug 2.2.2 py39haa95532_0 whatthepatch 1.0.2 py39haa95532_0 wheel 0.38.4 py39haa95532_0 widgetsnbextension 3.5.2 py39haa95532_0 win_inet_pton 1.1.0 py39haa95532_0 win_unicode_console 0.5 py39haa95532_0 wincertstore 0.2 py39haa95532_2 winpty 0.4.3 4 wrapt 1.14.1 py39h2bbff1b_0 xarray 2022.11.0 py39haa95532_0 xlrd 2.0.1 pyhd3eb1b0_0 xlsxwriter 3.0.3 pyhd3eb1b0_0 xlwings 0.27.15 py39haa95532_0 xz 5.2.10 h8cc25b3_1 yaml 0.2.5 he774522_0 yaml-cpp 0.7.0 hd77b12b_1 yapf 0.31.0 pyhd3eb1b0_0 zeromq 4.3.4 hd77b12b_0 zfp 0.5.5 hd77b12b_6 zict 2.1.0 py39haa95532_0 zipp 3.11.0 py39haa95532_0 zlib 1.2.13 hcfcfb64_4 conda-forge zope 1.0 py39haa95532_1 zope.interface 5.4.0 py39h2bbff1b_0 zstandard 0.18.0 py39h2bbff1b_0 zstd 1.5.2 h19a0ad4_0
Now that you know a little about me, let me tell you about the issue I am having:
Description of Issue
i ran this: import os import zipline from zipline.utils.run_algo import load_extensions from zipline.data import bundles from norgatedata import StockPriceAdjustmentType from zipline_norgatedata import ( register_norgatedata_equities_bundle, register_norgatedata_futures_bundle ) load_extensions( default=True, extensions=[], strict=True, environ=os.environ, )
bundles.ingest('norgatedata-fang', show_progress = False)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "g:/My Drive/Projects/Notebooks/zipline/zipline_ingest.py", line 18, in
bundles.ingest('norgatedata-fang', show_progress = False)
File "C:\Users\markg\anaconda3\envs\zip38\lib\site-packages\zipline\data\bundles\core.py", line 469, in ingest
downgrade(wf.path, version)
File "C:\Users\markg\anaconda3\envs\zip38\lib\contextlib.py", line 525, in exit
raise exc_details[1]
File "C:\Users\markg\anaconda3\envs\zip38\lib\contextlib.py", line 510, in exit
if cb(*exc_details):
File "C:\Users\markg\anaconda3\envs\zip38\lib\site-packages\zipline\utils\cache.py", line 385, in exit
rmtree(self.path)
File "C:\Users\markg\anaconda3\envs\zip38\lib\shutil.py", line 740, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Users\markg\anaconda3\envs\zip38\lib\shutil.py", line 613, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "C:\Users\markg\anaconda3\envs\zip38\lib\shutil.py", line 613, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "C:\Users\markg\anaconda3\envs\zip38\lib\shutil.py", line 618, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Users\markg\anaconda3\envs\zip38\lib\shutil.py", line 616, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\markg\AppData\Local\Temp\tmpbzksn37a\tmp029o9sqq\norgatedata-fang\2023-02-19T11;02;14.903658\assets-7.sqlite'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Users\markg\anaconda3\envs\zip38\lib\shutil.py", line 616, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\markg\AppData\Local\Temp\tmpbzksn37a\tmp029o9sqq\norgatedata-fang\2023-02-19T11;02;14.903658\assets-7.sqlite'
Here is how you can reproduce this issue on your machine:
Reproduction Steps
1.Load code as above 2.Run code 3. ...
What steps have you taken to resolve this already?
Searched all github issues and google but not found similar issue
...
Anything else?
I have tried closing every program that has anything to do with zipline being open, including explorer, jupyter etc
I have also tried saving the py file locally and running from there (not google drive) but same error occurs
...
Sincerely, windowspc\markg