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

docker-compose error #140

Closed
Armando0z opened this issue Dec 29, 2020 · 11 comments
Closed

docker-compose error #140

Armando0z opened this issue Dec 29, 2020 · 11 comments
Labels
question Further information is requested

Comments

@Armando0z
Copy link

I´ve encountered a problem trying to use the technical dependency with docker-compose (I´m able to use it when running freqtrade without docker). When trying to backtest or run a custom strategy I get this message:

2020-12-29 13:56:12,112 - freqtrade.resolvers.iresolver - WARNING - Could not import /freqtrade/user_data/strategies/trend_strategy.py due to 'No module named 'technical.vendor''

I carefully followed the steps in the guide:

https://www.freqtrade.io/en/latest/docker_quickstart/#additional-dependencies-with-docker-compose

and also tryed from scratch 2 times, but so far I have not succeed. After verifying I can run freqtrade on the default image (docker-compose comands working fine), these are the steps I took to add technical dependency:

  1. Create the file with the installation steps Dockerfile.technical with the following instructions (copied from: https://github.com/freqtrade/freqtrade/blob/develop/docker/Dockerfile.technical ) :
FROM freqtradeorg/freqtrade:develop

RUN apt-get update \
    && apt-get -y install git \
    && apt-get clean \
    && pip install git+https://github.com/freqtrade/technical
  1. Modify the docker-compose.yml file as the stated in the guide. after that, my file looks like this:
---
version: '3'
services:
  freqtrade:
    #image: freqtradeorg/freqtrade:stable
    image: freqtradeorg/freqtrade:custom
    # image: freqtradeorg/freqtrade:develop
    # Use plotting image
    #image: freqtradeorg/freqtrade:stable_plot
    # Build step - only needed when additional dependencies are needed
    build:
      context: .
      dockerfile: "./Dockerfile.technical"
    restart: unless-stopped
    container_name: freqtrade
    volumes:
      - "./user_data:/freqtrade/user_data"
    # Default command used when running `docker compose up`
    command: >
      trade
      --logfile /freqtrade/user_data/logs/freqtrade.log
      --db-url sqlite:////freqtrade/user_data/tradesv3.sqlite
      --config /freqtrade/user_data/config.json
      --strategy SampleStrategy
  1. Run command docker-compose build, to build the new image.

After this steps freqtrade rus correctly, but I'm still not able to backtest or run strategies that require the technical dependency (from docker-compose). Please tell me if I´m missing something in my installation steps, I haven´t been able to find the problem

Thanks in advance for your time and for helping me

@xmatthias
Copy link
Member

as long as you're using the compose file for backtesting (as documented here, the above seems correct.

@xmatthias xmatthias added the question Further information is requested label Dec 29, 2020
@Armando0z
Copy link
Author

Thanks for the reply,
I checked the link you posted, please correct me if I'm wrong... by "compose file" do you mean the docker-compose.yml file?

@Armando0z
Copy link
Author

When I was first trying to backtest a strategy that required techinical, I was doing it with the default docker image, so the error I got was this (same error you get when technical is not installed in a non-docker freqtrade):

Could not import /freqtrade/user_data/strategies/trend_strategy.py due to 'No module named 'technical''

But after I realized this and created the custom image with technical, now the error states 'No module named 'technical.vendor'', wich I´ve never seen in a non-docker instalation of technical. So I'm assuming the problem could in the image, or that the bot isn´t calling this module correctly.

Any idea how to make the bot find the technical.vendor module?

Thank you again for your time to answer, I have not much coding experience and haven´t been able to figure out this problem. I really appreciate your help

@xmatthias
Copy link
Member

If you use the command (or a similar command) as described in the linked documentation, the docker-image you specified in your docker-compose.yml file will be used.

e.g.
docker-compose run --rm freqtrade backtesting --config user_data/config.json --strategy SampleStrategy --timerange 20190801-20191001 -i 5m

Now one line concerns me (it'll depend on the version of freqtrade you're using) ...
does the dockerfile you specifh (dockerfile: "./Dockerfile.technical") really exist?
this was moved to docker/Dockerfile.technical a while ago.
Does building of the docker image work correctly?
if the same strategy (the one that's importing technical.vendor) works in trade mode, there's NO reason it wouldn't work in backtesting, unless you're using a wrong command (which is not using your custom image).

@Armando0z
Copy link
Author

Armando0z commented Dec 29, 2020

Thanks again for your answer,

  1. The docker file specifyed in dockerfile: "./Dockerfile.technial is only there because I created it (copied from https://github.com/freqtrade/freqtrade/blob/develop/docker/Dockerfile.technical ). the directory were I'm running docker-compose looks like this:
PS C:\ft_usderdata> ls


    Directorio: C:\ft_usderdata


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        29/12/2020     08:30                user_data
-a----        29/12/2020     11:03            780 docker-compose.yml
-a----        29/12/2020     11:37            181 Dockerfile.technical
  1. The docker image builds succesfuly after using the command:
PS C:\ft_usderdata> docker-compose build
Building freqtrade
Step 1/2 : FROM freqtradeorg/freqtrade:develop
 ---> 0d4d3ce16fcc
Step 2/2 : RUN apt-get update     && apt-get -y install git     && apt-get clean     && pip install git+https://github.com/freqtrade/technical
 ---> Using cache
 ---> b21163de5c73

Successfully built b21163de5c73
Successfully tagged freqtradeorg/freqtrade:custom
  1. The strategy doesn´t work in trade mode either. It gives me the same error when running the command:
    docker-compose run --rm freqtrade trade --strategy TrendStrategy

**I´ve only been able to trade and backtest the strategy in a separate installation without docker, installing technical in the freqtrade virtual environment, folowing the steps from the guide: https://github.com/freqtrade/technical

But I just haven´t been able to run the strategy from the docker-compose image
I hope this can give you a better picture of my problem,
Thanks a lot for helping

@xmatthias
Copy link
Member

xmatthias commented Dec 30, 2020

maybe try do delete both images and then rebuild them

it looks like it's using cache - which hides the "real" installation process - so maybe "something" failed along the way ...

docker rmi freqtradeorg/freqtrade:develop
docker rmi freqtradeorg/freqtrade:custom

@Armando0z
Copy link
Author

I just tryed the commands you posted to delete the images, and then I run docker-compose build, the image was built succesfully, but the problem persists. No module named 'technical.vendor'
Thanks for your answer, I hope there´s a solution to this, so far I´ve only been able to work without docker (not optimal, as I´m testing on different vps's to run the bot)
Do you think It´s possible that the instalation from && pip install git+https://github.com/freqtrade/technical could be missing something? (last installation step from the Dockerfile.technical

@elgramato
Copy link

Unfortunately, I have exactly the same problem.
I have also deleted all images and created new ones. (as you described)
In addition to && pip install git+https://github.com/freqtrade/technical, I also tried && pip install technical.
The image is always created correctly.
But I still get the error:

2020-12-31 07:55:11,828 - freqtrade.resolvers.iresolver - WARNING - Could not import /freqtrade/user_data/hyperopts/MyHyperoptAdvancedTechnical.py due to 'No module named 'technical.vendor''
2020-12-31 07:55:11,840 - freqtrade - ERROR - Impossible to load Hyperopt 'MyHyperoptAdvancedTechnical'. This class does not exist or contains Python code errors.

@xmatthias
Copy link
Member

Please delete the "sub-image" that includes technical and run the installation again, and it'll work.

@elgramato
Copy link

Please delete the "sub-image" that includes technical and run the installation again, and it'll work.

Yes. That looks good!
It works for me now.
Thank you for the quick fix

@Armando0z
Copy link
Author

Thanks a lot! now its working!

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

No branches or pull requests

3 participants