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

libWtDtPorter.so 的问题 #129

Closed
linonetwo opened this issue Oct 25, 2023 · 2 comments
Closed

libWtDtPorter.so 的问题 #129

linonetwo opened this issue Oct 25, 2023 · 2 comments

Comments

@linonetwo
Copy link

linonetwo commented Oct 25, 2023

在尝试运行 demo 时这样报错:

(trading_env) % python './datakit_stk/runDT.py'     
Traceback (most recent call last):
  File "./datakit_stk/runDT.py", line 5, in <module>
    env = WtDtEngine()
          ^^^^^^^^^^^^
  File "./trading_env/lib/python3.11/site-packages/wtpy/WtUtilDefs.py", line 5, in getinstance
    instances[cls] = cls(*args,**kwargs)
                     ^^^^^^^^^^^^^^^^^^^
  File "./trading_env/lib/python3.11/site-packages/wtpy/WtDtEngine.py", line 10, in __init__
    self.__wrapper__ = WtDtWrapper(self)  #api接口转换器
                       ^^^^^^^^^^^^^^^^^
  File "./trading_env/lib/python3.11/site-packages/wtpy/WtUtilDefs.py", line 5, in getinstance
    instances[cls] = cls(*args,**kwargs)
                     ^^^^^^^^^^^^^^^^^^^
  File "./trading_env/lib/python3.11/site-packages/wtpy/wrapper/WtDtWrapper.py", line 34, in __init__
    self.api = cdll.LoadLibrary(_path)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py", line 454, in LoadLibrary
    return self._dlltype(name)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: dlopen(./trading_env/lib/python3.11/site-packages/wtpy/wrapper/linux/libWtDtPorter.so, 0x0006): tried: '~/.wasmedge/lib/libWtDtPorter.so' (no such file), './trading_env/lib/python3.11/site-packages/wtpy/wrapper/linux/libWtDtPorter.so' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS./trading_env/lib/python3.11/site-packages/wtpy/wrapper/linux/libWtDtPorter.so' (no such file), './trading_env/lib/python3.11/site-packages/wtpy/wrapper/linux/libWtDtPorter.so' (not a mach-o file)

我已经 pip install wtpy 安装了 0.9.8, 并 pip install -r ./requirements.txt ( requirements.txt 从 wtpy 仓库复制而来)

我是第一次尝试安装使用,请问这个问题如何解决?

@linonetwo
Copy link
Author

linonetwo commented Nov 3, 2023

Mac 支持可能有问题,我目前用 docker 启动,这里是我的例子:

# Use an official lightweight Python runtime as a parent image
FROM python:3.8-slim

# Set the working directory to /app
WORKDIR /app

# Copy only the requirements file, to cache the dependencies
COPY requirements.txt /app/
RUN pip install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
RUN pip install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple wtpy

# Copy the rest of the application code
COPY . /app

# Make port 80 available to the world outside this container
EXPOSE 80

# Define environment variable (example)
ENV NAME World
ENV PYTHONPATH /app

# Set the working directory to /app/cta_fut_bt , so `sys.path.append('../Strategies')` works
WORKDIR /demos/ctp_loader

# Run app.py when the container launches
CMD ["python", "./run.py"]

把它放在 wtpy 仓库里,命令行运行

docker build -t wtpy-app . -f ./DockerFile
docker run -p 4000:80 wtpy-app

@linonetwo
Copy link
Author

群里说可以尝试 mac 分支,是贡献者写的,目前还未合并。不过我是用 docker 了。

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

1 participant