Repository: freqtrade/freqtrade

Issue:
Hyperopt error Windows
## Step 1: Have you search for this issue before posting it?

If you have discovered a bug in the bot, please [search our issue tracker](https://github.com/freqtrade/freqtrade/issues?q=is%3Aissue). 
If it hasn't been reported, please create a new issue.

## Step 2: Describe your environment

  * Python Version: Python 3.6.3
  * CCXT version: ccxt==1.17.283
  * Branch: Master 
  * Last Commit ID: bcf47b29ed523b71190469949e0251d748d48c07
  
## Step 3: Describe the problem:

I was trying to hyperopt my strategies, and when i'm trying this error appears.
"AttributeError: Can't get attribute 'estrategia_teste' on <module 'freqtrade.strategy' from"
I'm using windows, and i can do backtest.
Command line i'm using: "python main.py hyperopt"
  
### Observed Results:

  * What happened?
  * What did you expect to happen?

### Relevant code exceptions or logs:
```
Process SpawnPoolWorker-2:
Traceback (most recent call last):
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 258, in _bootstrap
    self.run()
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "c:\server\python\conda\Lib\multiprocessing\pool.py", line 108, in worker
    task = get()
  File "C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\externals\joblib\pool.py", line 362, in get
    return recv()
  File "c:\server\python\conda\Lib\multiprocessing\connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
AttributeError: Can't get attribute 'estrategia_teste' on <module 'freqtrade.strategy' from 'c:\\users\\nayara costa\\desktop\\d
```


Discussion:
the error suggests that the strategy cannot be loaded.

The problem in debugging hyperopt is currently that it requires you to change the hyperopt-file.
If you can share the changes you made, that should help in debugging the issue.
I'm using the default file from hyperopt and the error persist.
This is the error log from prompt.

```
2018-09-23 10:26:57,677 - freqtrade.configuration - INFO - Verbosity set to 0
2018-09-23 10:26:57,678 - freqtrade.configuration - INFO - Dry run is enabled
2018-09-23 10:26:57,678 - freqtrade.configuration - INFO - Using DB: "sqlite://"
2018-09-23 10:26:57,678 - freqtrade.configuration - INFO - Using max_open_trades: 10 ...
2018-09-23 10:26:57,679 - freqtrade.configuration - INFO - Using data folder: user_data\data\binance ...
2018-09-23 10:26:57,680 - freqtrade.configuration - INFO - Parameter --epochs detected ...
2018-09-23 10:26:57,680 - freqtrade.configuration - INFO - Will run Hyperopt with for 10 epochs ...
2018-09-23 10:26:57,680 - freqtrade.configuration - INFO - Parameter -s/--spaces detected: all
2018-09-23 10:26:57,681 - freqtrade.strategy.resolver - WARNING - Path "/some/folder/" does not exist
2018-09-23 10:26:57,683 - freqtrade.strategy.resolver - INFO - Using resolved strategy DefaultStrategy from 'C:\Users\Nayara Costa\Desktop\Daniel\RoboCripto\freqtrade\freqtrade\user_data\strategies'
2018-09-23 10:26:57,684 - freqtrade.strategy.resolver - INFO - Override strategy 'minimal_roi' with value in config file: {'0': 0.1}.
2018-09-23 10:26:57,684 - freqtrade.strategy.resolver - INFO - Override strategy 'stoploss' with value in config file: -0.03.
2018-09-23 10:26:57,685 - freqtrade.strategy.resolver - INFO - Override strategy 'ticker_interval' with value in config file: 5m.
2018-09-23 10:26:57,685 - freqtrade.strategy.resolver - WARNING - Path "/some/folder/" does not exist
2018-09-23 10:26:57,687 - freqtrade.strategy.resolver - INFO - Using resolved strategy DefaultStrategy from 'C:\Users\Nayara Costa\Desktop\Daniel\RoboCripto\freqtrade\freqtrade\user_data\strategies'
2018-09-23 10:26:57,688 - freqtrade.strategy.resolver - INFO - Override strategy 'minimal_roi' with value in config file: {'0': 0.1}.
2018-09-23 10:26:57,689 - freqtrade.strategy.resolver - INFO - Override strategy 'stoploss' with value in config file: -0.03.
2018-09-23 10:26:57,689 - freqtrade.strategy.resolver - INFO - Override strategy 'ticker_interval' with value in config file: 5m.
2018-09-23 10:26:57,689 - freqtrade.strategy.resolver - INFO - Override process_only_new_candles 'process_only_new_candles' with value in config file: False.
2018-09-23 10:26:57,691 - freqtrade.exchange - INFO - Instance is running with dry_run enabled
2018-09-23 10:26:58,763 - freqtrade.exchange - INFO - Using Exchange "Binance"
2018-09-23 10:27:07,207 - freqtrade.optimize.hyperopt - INFO - Found 4 CPU cores. Let's make them scream!
C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\ensemble\weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.
  from numpy.core.umath_tests import inner1d
Process SpawnPoolWorker-3:
Traceback (most recent call last):
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 258, in _bootstrap
    self.run()
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "c:\server\python\conda\Lib\multiprocessing\pool.py", line 108, in worker
    task = get()
  File "C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\externals\joblib\pool.py", line 362, in get
    return recv()
  File "c:\server\python\conda\Lib\multiprocessing\connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
AttributeError: Can't get attribute 'DefaultStrategy' on <module 'freqtrade.strategy' from 'c:\\users\\nayara costa\\desktop\\daniel\\robocripto\\freqtrade\\freqtrade\\strategy\\__init__.py'>
C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\ensemble\weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.
  from numpy.core.umath_tests import inner1d
Process SpawnPoolWorker-2:
Traceback (most recent call last):
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 258, in _bootstrap
    self.run()
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "c:\server\python\conda\Lib\multiprocessing\pool.py", line 108, in worker
    task = get()
  File "C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\externals\joblib\pool.py", line 362, in get
    return recv()
  File "c:\server\python\conda\Lib\multiprocessing\connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
AttributeError: Can't get attribute 'DefaultStrategy' on <module 'freqtrade.strategy' from 'c:\\users\\nayara costa\\desktop\\daniel\\robocripto\\freqtrade\\freqtrade\\strategy\\__init__.py'>
C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\ensemble\weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.
  from numpy.core.umath_tests import inner1d
Process SpawnPoolWorker-1:
Traceback (most recent call last):
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 258, in _bootstrap
    self.run()
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "c:\server\python\conda\Lib\multiprocessing\pool.py", line 108, in worker
    task = get()
  File "C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\externals\joblib\pool.py", line 362, in get
    return recv()
  File "c:\server\python\conda\Lib\multiprocessing\connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
AttributeError: Can't get attribute 'DefaultStrategy' on <module 'freqtrade.strategy' from 'c:\\users\\nayara costa\\desktop\\daniel\\robocripto\\freqtrade\\freqtrade\\strategy\\__init__.py'>
C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\ensemble\weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.
  from numpy.core.umath_tests import inner1d
Process SpawnPoolWorker-4:
Traceback (most recent call last):
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 258, in _bootstrap
    self.run()
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "c:\server\python\conda\Lib\multiprocessing\pool.py", line 108, in worker
    task = get()
  File "C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\externals\joblib\pool.py", line 362, in get
    return recv()
  File "c:\server\python\conda\Lib\multiprocessing\connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
AttributeError: Can't get attribute 'DefaultStrategy' on <module 'freqtrade.strategy' from 'c:\\users\\nayara costa\\desktop\\daniel\\robocripto\\freqtrade\\freqtrade\\strategy\\__init__.py'>
```
I am not sure if hyperopt is working natively in windows (which you appear to be using - judging from the paths).
It should work when using WLS (Windows linux subsystem) - but natively in windows, i'm absolutely not sure as i never tried.

> I am not sure if hyperopt is working natively in windows (which you appear to be using - judging from the paths).
> It should work when using WLS (Windows linux subsystem) - but natively in windows, i'm absolutely not sure as i never tried.

It works on my windows 7 laptop .
(not WLS Windows linux subsystem )
(just cmder+scoop+python3.6+freqtrade develop)

the DefaultStrategy  should be in
"freqtrade\strategy"
but on log:
"Using resolved strategy DefaultStrategy from 'C:\Users\Nayara Costa\Desktop\Daniel\RoboCripto\freqtrade\freqtrade\user_data\strategies'"

what "WARNING - Path "/some/folder/" does not exist“ ？
remove the " --strategy-path /some/folder" from your command,i think ,it should be working .

last but not the least,

do run the following:

pip install -r requirements.txt
pip install -e .

I've installed pip install -e.
pip install -r requirements.txt

I changed my command line for this:
"python main.py -c config.json --strategy-path C:\Teste hyperopt -e 200"

And the error:

(robot) (C:\server\python\conda) C:\Users\Nayara Costa\Desktop\Daniel\RoboCripto\freqtrade\freqtrade>python main.py -c config.json --strategy-path C:\Teste hyperopt -e 200
C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\ensemble\weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.
  from numpy.core.umath_tests import inner1d
2018-09-25 20:12:37,854 - freqtrade.configuration - INFO - Verbosity set to 0
2018-09-25 20:12:37,855 - freqtrade.configuration - INFO - Dry run is enabled
2018-09-25 20:12:37,855 - freqtrade.configuration - INFO - Using DB: "sqlite://"
2018-09-25 20:12:37,856 - freqtrade.configuration - INFO - Using max_open_trades: 10 ...
2018-09-25 20:12:37,856 - freqtrade.configuration - INFO - Using data folder: user_data\data\binance ...
2018-09-25 20:12:37,857 - freqtrade.configuration - INFO - Parameter --epochs detected ...
2018-09-25 20:12:37,857 - freqtrade.configuration - INFO - Will run Hyperopt with for 200 epochs ...
2018-09-25 20:12:37,858 - freqtrade.configuration - INFO - Parameter -s/--spaces detected: all
2018-09-25 20:12:37,860 - freqtrade.strategy.resolver - INFO - Using resolved strategy DefaultStrategy from 'C:\Teste'
2018-09-25 20:12:37,861 - freqtrade.strategy.resolver - INFO - Override strategy 'minimal_roi' with value in config file: {'0': 0.1}.
2018-09-25 20:12:37,861 - freqtrade.strategy.resolver - INFO - Override strategy 'stoploss' with value in config file: -0.03.
2018-09-25 20:12:37,862 - freqtrade.strategy.resolver - INFO - Override strategy 'ticker_interval' with value in config file: 5m.
2018-09-25 20:12:37,863 - freqtrade.strategy.resolver - INFO - Using resolved strategy DefaultStrategy from 'C:\Teste'
2018-09-25 20:12:37,864 - freqtrade.strategy.resolver - INFO - Override strategy 'minimal_roi' with value in config file: {'0': 0.1}.
2018-09-25 20:12:37,865 - freqtrade.strategy.resolver - INFO - Override strategy 'stoploss' with value in config file: -0.03.
2018-09-25 20:12:37,865 - freqtrade.strategy.resolver - INFO - Override strategy 'ticker_interval' with value in config file: 5m.
2018-09-25 20:12:37,865 - freqtrade.strategy.resolver - INFO - Override process_only_new_candles 'process_only_new_candles' with value in config file: False.
2018-09-25 20:12:37,866 - freqtrade.exchange - INFO - Instance is running with dry_run enabled
2018-09-25 20:12:38,923 - freqtrade.exchange - INFO - Using Exchange "Binance"
2018-09-25 20:12:45,259 - freqtrade.optimize.hyperopt - INFO - Found 4 CPU cores. Let's make them scream!
C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\ensemble\weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.
  from numpy.core.umath_tests import inner1d
Process SpawnPoolWorker-2:
Traceback (most recent call last):
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 258, in _bootstrap
    self.run()
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "c:\server\python\conda\Lib\multiprocessing\pool.py", line 108, in worker
    task = get()
  File "C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\externals\joblib\pool.py", line 362, in get
    return recv()
  File "c:\server\python\conda\Lib\multiprocessing\connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
AttributeError: Can't get attribute 'DefaultStrategy' on <module 'freqtrade.strategy' from 'c:\\users\\nayara costa\\desktop\\daniel\\robocripto\\freqtrade\\freqtrade\\strategy\\__init__.py'>
C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\ensemble\weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.
  from numpy.core.umath_tests import inner1d
Process SpawnPoolWorker-4:
Traceback (most recent call last):
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 258, in _bootstrap
    self.run()
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "c:\server\python\conda\Lib\multiprocessing\pool.py", line 108, in worker
    task = get()
  File "C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\externals\joblib\pool.py", line 362, in get
    return recv()
  File "c:\server\python\conda\Lib\multiprocessing\connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
AttributeError: Can't get attribute 'DefaultStrategy' on <module 'freqtrade.strategy' from 'c:\\users\\nayara costa\\desktop\\daniel\\robocripto\\freqtrade\\freqtrade\\strategy\\__init__.py'>
C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\ensemble\weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.
  from numpy.core.umath_tests import inner1d
Process SpawnPoolWorker-3:
Traceback (most recent call last):
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 258, in _bootstrap
    self.run()
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "c:\server\python\conda\Lib\multiprocessing\pool.py", line 108, in worker
    task = get()
  File "C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\externals\joblib\pool.py", line 362, in get
    return recv()
  File "c:\server\python\conda\Lib\multiprocessing\connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
AttributeError: Can't get attribute 'DefaultStrategy' on <module 'freqtrade.strategy' from 'c:\\users\\nayara costa\\desktop\\daniel\\robocripto\\freqtrade\\freqtrade\\strategy\\__init__.py'>
C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\ensemble\weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.
  from numpy.core.umath_tests import inner1d
Process SpawnPoolWorker-1:
Traceback (most recent call last):
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 258, in _bootstrap
    self.run()
  File "c:\server\python\conda\Lib\multiprocessing\process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "c:\server\python\conda\Lib\multiprocessing\pool.py", line 108, in worker
    task = get()
  File "C:\Users\NAYARA~1\Desktop\Daniel\ROBOCR~1\robot\lib\site-packages\sklearn\externals\joblib\pool.py", line 362, in get
    return recv()
  File "c:\server\python\conda\Lib\multiprocessing\connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
AttributeError: Can't get attribute 'DefaultStrategy' on <module 'freqtrade.strategy' from 'c:\\users\\nayara costa\\desktop\\daniel\\robocripto\\freqtrade\\freqtrade\\strategy\\__init__.py'>
can you please post the output of the following command:
```
pip freeze | grep scikit-learn
```

if you installed scikit-lear through another method, please try to find the version-number for this.

#1240 shows that 0.20 seems to cause a problem with hyperopt.

The result for the comand pip freeze scikit-learn.

Python version: Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32

(robo32) C:\Teste\robo32\Scripts>pip freeze scikit-learn
aiodns==1.1.1
aiohttp==3.4.4
arrow==0.12.1
asn1crypto==0.24.0
async-timeout==3.0.0
atomicwrites==1.2.1
attrdict==2.0.0
attrs==18.2.0
cachetools==2.1.0
ccxt==1.17.350
certifi==2018.8.24
cffi==1.11.5
chardet==3.0.4
coinmarketcap==5.0.3
colorama==0.3.9
coverage==4.5.1
cryptography==2.3.1
cytoolz==0.9.0.1
eth-abi==1.2.0
eth-account==0.3.0
eth-hash==0.2.0
eth-keyfile==0.5.1
eth-keys==0.2.0b3
eth-rlp==0.1.2
eth-typing==1.3.0
eth-utils==1.2.2
-e git+https://github.com/freqtrade/freqtrade.git@d04247cd9ea1180a960365ec08f66c115cd092c6#egg=freqtrade
future==0.16.0
hexbytes==0.1.0
idna==2.7
idna-ssl==1.1.0
jsonschema==2.6.0
lru-dict==1.1.6
more-itertools==4.3.0
multidict==4.4.2
numpy==1.15.2
pandas==0.23.4
parsimonious==0.8.0
pluggy==0.7.1
py==1.6.0
pycares==2.3.0
pycparser==2.19
pycryptodome==3.6.6
pypiwin32==223
pytest==3.8.1
pytest-asyncio==0.9.0
pytest-cov==2.6.0
pytest-mock==1.10.0
python-dateutil==2.7.3
python-telegram-bot==11.1.0
pytz==2018.5
pywin32==223
requests==2.19.1
requests-cache==0.4.13
rlp==1.0.2
scikit-learn==0.19.2
scikit-optimize==0.5.2
scipy==1.1.0
six==1.11.0
SQLAlchemy==1.2.12
TA-Lib==0.4.17
tabulate==0.8.2
toolz==0.9.0
urllib3==1.22
web3==4.6.0
websockets==6.0
wrapt==1.10.11
yarl==1.1.0

Resolving patch:
diff --git a/freqtrade/optimize/hyperopt.py b/freqtrade/optimize/hyperopt.py
--- a/freqtrade/optimize/hyperopt.py
+++ b/freqtrade/optimize/hyperopt.py
@@ -152,7 +152,7 @@ def calculate_loss(self, total_profit: float, trade_count: int, trade_duration:
     @staticmethod
     def generate_roi_table(params: Dict) -> Dict[int, float]:
         """
-        Generate the ROI table thqt will be used by Hyperopt
+        Generate the ROI table that will be used by Hyperopt
         """
         roi_table = {}
         roi_table[0] = params['roi_p1'] + params['roi_p2'] + params['roi_p3']
@@ -402,6 +402,13 @@ def start(args: Namespace) -> None:
     config['exchange']['key'] = ''
     config['exchange']['secret'] = ''
 
+    if config.get('strategy') and config.get('strategy') != 'DefaultStrategy':
+        logger.error("Please don't use --strategy for hyperopt.")
+        logger.error(
+            "Read the documentation at "
+            "https://github.com/freqtrade/freqtrade/blob/develop/docs/hyperopt.md "
+            "to understand how to configure hyperopt.")
+        raise ValueError("--strategy configured but not supported for hyperopt")
     # Initialize backtesting object
     hyperopt = Hyperopt(config)
     hyperopt.start()
diff --git a/freqtrade/strategy/__init__.py b/freqtrade/strategy/__init__.py
--- a/freqtrade/strategy/__init__.py
+++ b/freqtrade/strategy/__init__.py
@@ -3,7 +3,8 @@
 from copy import deepcopy
 
 from freqtrade.strategy.interface import IStrategy
-
+# Import Default-Strategy to have hyperopt correctly resolve
+from freqtrade.strategy.default_strategy import DefaultStrategy  # noqa: F401
 
 logger = logging.getLogger(__name__)
 


Test patch:
diff --git a/freqtrade/tests/optimize/test_hyperopt.py b/freqtrade/tests/optimize/test_hyperopt.py
--- a/freqtrade/tests/optimize/test_hyperopt.py
+++ b/freqtrade/tests/optimize/test_hyperopt.py
@@ -65,6 +65,31 @@ def test_start(mocker, default_conf, caplog) -> None:
     assert start_mock.call_count == 1
 
 
+def test_start_failure(mocker, default_conf, caplog) -> None:
+    start_mock = MagicMock()
+    mocker.patch(
+        'freqtrade.configuration.Configuration._load_config_file',
+        lambda *args, **kwargs: default_conf
+    )
+    mocker.patch('freqtrade.optimize.hyperopt.Hyperopt.start', start_mock)
+    patch_exchange(mocker)
+
+    args = [
+        '--config', 'config.json',
+        '--strategy', 'TestStrategy',
+        'hyperopt',
+        '--epochs', '5'
+    ]
+    args = get_args(args)
+    StrategyResolver({'strategy': 'DefaultStrategy'})
+    with pytest.raises(ValueError):
+        start(args)
+    assert log_has(
+        "Please don't use --strategy for hyperopt.",
+        caplog.record_tuples
+    )
+
+
 def test_loss_calculation_prefer_correct_trade_count(hyperopt) -> None:
     StrategyResolver({'strategy': 'DefaultStrategy'})