summaryrefslogtreecommitdiffstats
path: root/TROUBLESHOOT.md
blob: ca4fc10ecea2b485c73913063ab74391d60fddd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# TROUBLESHOOT

If you are visiting this page it means that you're having issues installing. We deeply apologize for that.

Since the start of the project we've come across different types of issues experienced by the users. This page tries to
combine issues, and their solutions. This will allow to give the best install experience to everyone regardless of any
programming skills.

<ol>
<li>
  <a href="#">Standard Install Troubles</a>
  <ul>
    <li><a href="#microsoft-visual-v++">Microsoft Visual C++</a></li>
    <li><a href="#wheel">Wheel</a></li>
    <li><a href="#cvxpy">Cvxpy</a></li>
    <li><a href="#numpy">Numpy</a></li>
    <li><a href="#Poetry">Poetry</a></li>
  </ul>
</li>
<li>
  <a href="#">ModuleNotFoundError Trouble</a>
  <ul>
    <li><a href="#general">General</a></li>
    <li><a href="#pypfopt">pypfopt</a></li>
    <li><a href="#dotenv">dotenv</a></li>
    <li><a href="#ally">ally</a></li>
  </ul>
</li>
<li>
  <a href="#machine-learning-troubles">Machine Learning Troubles</a>
</li>
<li>
  <a href="#other-issues">Other Issues</a>
  <ul>
    <li><a href="#CRLF-versus-LF">CRLF versus LF</a></li>
  </ul>
</li>
</ol>

## Standard Install Troubles

### Microsoft Visual C++

If your terminal has too many red error lines, it is likely that this is the issue.
Go to this page and install the 2019 Build Tools (not the latest):
<https://answers.microsoft.com/en-us/windows/forum/windows_other-windows_install/microsoft-visual-c-140/6f0726e2-6c32-4719-9fe5-aa68b5ad8e6d>

### Wheel

`conda install -c conda-forge wheel` or `pip install wheel`

### Cvxpy

```bash
conda install -c conda-forge cvxpy
```

### Numpy

```bash
pip install --upgrade numpy==1.20.2
```

### Poetry

If you get errors about .whl files not existing (usually on Windows) you have to reinitialize the following folder.
Just removing the 'artifacts' folder could also be enough:

| Platform | Location                        |
| -------- | ------------------------------- |
| Linux    | "~/.cache/pypoetry"             |
| Mac      | "~/Library/Caches/pypoetry"     |
| Windows  | "%localappdata%/pypoetry/cache" |

When you try to add a package to Poetry it is possible that it causes a similar issue. Here you can remove the
'artifacts' folder again to reinitialize Poetry.

If you run into trouble with Poetry, and the advice above did not help, your best bet is to try

1. `poetry update --lock`

2. `conda deactivate` -> `conda activate gst`, then try again

3. Track down the offensive package and purge it from your anaconda `<environment_name>` folder, then try again
   (removing through conda can sometimes leave locks behind)

   | Platform  | Location                                     |
   | --------- | -------------------------------------------- |
   | Linux/Mac | "~/anaconda3/envs" or "~/opt/anaconda3/envs" |
   | Windows   | "%userprofile%/anaconda3/envs"               |

4. Completely nuke your conda environment folder and make a new environment from scratch

5. Reboot your computer and try again

6. Submit a ticket on GitHub

#### JSONDecodeError during `poetry install`

Sometimes poetry can throw a `JSONDecodeError` on random packages while running `poetry install`.
This can be observed on macOS 10.14+ running python 3.8+.
This is because of the use of an experimental installer that can be switched off to avoid the mentioned error.
Run

```bash
poetry config experimental.new-installer false
```

as advised [here](https://github.com/python-poetry/poetry/issues/4210) and it should fix the installation process.

## ModuleNotFoundError Trouble

### General

In the case when you run into an error of the form `ModuleNotFoundError: No module named '_______'`. The solution is to
install the missing package via pip.

If you get the error that `yfinance` is not found, you would run

- `pip install yfinance`

Then please submit an issue so that we can address why that was not imported.

Please note that the package `pmdarima` needs to installed through `pip install` and not through `conda install`.

### pypfopt

```bash
pip install PyPortfolioOpt
```

### dotenv

```bash
pip install python-dotenv
```

### ally

```bash
pip install pyally
```

### Machine Learning Troubles

If you run into issues installing or `Cannot convert a symbolic Tensor...` at runtime, try this:

```bash
conda install -c conda-forge numpy=1.19.5 hdf5=1.10.5
poetry install
poetry install -E prediction
```

_Commands that may help you in case of an error:_

- `python -m pip install --upgrade pip`
- `pip install pystan --upgrade`
- `poetry update --lock`

## Other Issues

### CRLF versus LF

When trying to commit code changes, pylint will prevent you from doing so if your line break settings are set to
CRLF (default for Windows). This is because the entire package uses LF (default for Linux/Mac), and it is therefore
important that you change this setting to LF _before_ you make any changes to the code.

It is possible that CRLF automatically turns back on, you can correct this with:

```bash
git config --global core.autocrlf false
```

In case you already made coding adjustments, you have to reset your cache, and the changes you made to the code with
the following:

```bash
git rm --cached -r .
git reset --hard
```

### Unable to run gst from VS Code integrated terminal

Occurs when vscode terminal python version/path is different from the terminal version.

To fix it add this to vscode JSON settings ([ref](https://stackoverflow.com/questions/54582361/vscode-terminal-shows-incorrect-python-version-and-path-launching-terminal-from)):

```bash
    "terminal.integrated.inheritEnv": false,
```