Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyCharm IDE problem #80

Closed
ssqd2022 opened this issue Jan 17, 2022 · 2 comments
Closed

PyCharm IDE problem #80

ssqd2022 opened this issue Jan 17, 2022 · 2 comments

Comments

@ssqd2022
Copy link

ssqd2022 commented Jan 17, 2022

Dear Developers:

When I extracted all the newest codes (2022-Jan-17) into PyCharm IDE (2021.3.1 Community Edition), and created a virtual Python 3.8 environment, it automatically detected that "Package requirements 'pyecharts>=1.9.0', 'tqdm', 'pandas>=1.1.0', 'zb>=0.0.14', 'numpy>=1.16.5', 'transitions', 'tushare', 'python-docx>=0.8.11','matplotlib','seaborn','Deprecated>=1.2.12' are not satisfied". This prompted me automatically install these package after clicking a button "Install requirements".

After such successful installation, I did run the following commands, within PyCharm IDE:

(1) setup.py --help

Successful, to see what commands I can run

(2) setup.py install

Most success, but with the following warning

reating 'dist/czsc-0.8.13-py3.8.egg' and adding 'build/bdist.linux-x86_64/egg' to it
zip_safe flag not set; analyzing archive contents...
czsc.sensors.pycache.plates.cpython-38: module MAY be using inspect.getsource
czsc.sensors.pycache.stocks.cpython-38: module MAY be using inspect.getsource
hist.scripts_gm_20211212.pycache.run_share_bt.cpython-38: module references file
hist.scripts_gm_20211212.pycache.run_share_rt.cpython-38: module references file
hist.scripts_gm_20211212.src.utils.pycache.bt.cpython-38: module MAY be using inspect.getsource
hist.scripts_gm_20211212.src.utils.pycache.rt.cpython-38: module MAY be using inspect.getsource

(3) setup.py build

Successful, I saw the build directory with sub directories 'lib' and 'bdist.linux-x86_64' were created

(4) When I run the core code 'analyze.py' without any arguments or inputs, I got the following error:

Traceback (most recent call last):
File "/home/Downloads/czsc-master/czsc/analyze.py", line 3, in
import webbrowser
File "/usr/lib/python3.8/webbrowser.py", line 6, in
import shlex
File "/usr/lib/python3.8/shlex.py", line 11, in
import re
File "/usr/lib/python3.8/re.py", line 124, in
import enum
File "/home/Downloads/czsc-master/czsc/enum.py", line 3, in
from enum import Enum
ImportError: cannot import name 'Enum' from partially initialized module 'enum' (most likely due to a circular import)

(5) For the 'bar_generator.py' under the folder 'utils', it has the following statement:

from ..objects import RawBar, Freq

I know this is to import the 'object.py' within the parent folder ('czcs') of 'utils'. After running this code without any arguments or inputs, I got the following error:

/home/Downloads/czsc-master/venv/bin/python /home/Downloads/czsc-master/czsc/utils/bar_generator.py
Traceback (most recent call last):
File "/home/Downloads/czsc-master/czsc/utils/bar_generator.py", line 10, in
from ..objects import RawBar, Freq
ImportError: attempted relative import with no known parent package

I noticed that the library inclusion in this package uses folders and sub-folder structures, which causes "circular import" problem with PyCharm IDE.

I am curious that has anyone ever encounters such a problem? Or, what python IDE do you use, which does not have any problems such as "circular import".

Thank you for your attention! Your help will be highly appreciated!

John

@zengbin93
Copy link
Member

There are not any "circular import" in czsc source code. As a third library, you should install czsc by pip install czsc or python setup.py install, then use it in your python console, for example:

import czsc
from czsc.objects import RawBar, Freq

After execute codes above, you will see version hints like:

欢迎使用CZSC!当前版本标识为 0.8.13@20220111

不要预测任何消息的影响,而应该仔细观察市场对消息的反应,即市场走势本身。如感冒之于人的体
质,消息是测试市场体质的,而不是用来预测的。 
--摘自《即缠非缠》微博 2021-11-16

@ssqd2022
Copy link
Author

Thank you so much for your help.

Using your approach, I am able to compile all *.py files in "czsc/utilis" folder, except ta1.py.

File "/home/Downloads/czsc-master/czsc/utils/ta1.py", line 9, in
import talib as ta
ModuleNotFoundError: No module named 'talib

I also cannot find talib with "pip install talib".

Is this talib one of your own library? How should I import it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants