 
 
 (use-package! anaconda-mode
-  :after python
+  :defer t
   :init
   (setq anaconda-mode-installation-directory (concat doom-etc-dir "anaconda/")
         anaconda-mode-eldoc-as-single-line t)
+
+  (add-hook! 'python-mode-local-vars-hook
+    (defun +python-init-anaconda-mode-maybe-h ()
+      "Enable `anaconda-mode' if `lsp-mode' isn't."
+      (unless (or (bound-and-true-p lsp-mode)
+                  (bound-and-true-p lsp--buffer-deferred))
+        (anaconda-mode +1))))
   :config
   (add-hook 'anaconda-mode-hook #'anaconda-eldoc-mode)
   (set-company-backend! 'anaconda-mode '(company-anaconda))

  :init
  (setq python-environment-directory doom-cache-dir
        python-indent-guess-indent-offset-verbose nil)
  :config
  (set-repl-handler! 'python-mode #'+python/open-repl :persist t)
  (set-docsets! 'python-mode "Python 3" "NumPy" "SciPy")



(use-package! pyimport
  :defer t
  :init
  (map! :after python
        :map python-mode-map
        :localleader
        (:prefix ("i" . "imports")
          :desc "Insert missing imports" "i" #'pyimport-insert-missing
