Questions tagged [package]
Package broadly refers to two things: 1) a usable unit/component of built/compiled software, or 2) a partition of the global namespace (Java).
package
1,885
questions
3792
votes
14
answers
2.5m
views
What is __init__.py for?
What is __init__.py for in a Python source directory?
716
votes
19
answers
1.0m
views
How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?
I tried to install a package, using
install.packages("foobarbaz")
but received the warning
Warning message:
package 'foobarbaz' is not available (for R version x.y.z)
Why doesn't R think that the ...
652
votes
30
answers
528k
views
Can you find all classes in a package using reflection?
Is it possible to find all classes or interfaces in a given package? (Quickly looking at e.g. Package, it would seem like no.)
306
votes
34
answers
1.8m
views
How can I solve "java.lang.NoClassDefFoundError"?
I've tried both the examples in Oracle's Java Tutorials. They both compile fine, but at run time, both come up with this error:
Exception in thread "main" java.lang.NoClassDefFoundError: ...
842
votes
23
answers
664k
views
How to fix "Attempted relative import in non-package" even with __init__.py
I'm trying to follow PEP 328, with the following directory structure:
pkg/
__init__.py
components/
core.py
__init__.py
tests/
core_test.py
__init__.py
In core_test.py I have ...
672
votes
8
answers
174k
views
What is the difference between require() and library()?
What is the difference between require() and library()?
407
votes
32
answers
1.2m
views
"pip install unroll": "python setup.py egg_info" failed with error code 1
I'm trying to install some packages with pip.
But pip install unroll gives me
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\MARKAN~1\AppData\Local\Temp\pip-build-...
388
votes
12
answers
240k
views
Sibling package imports
I've tried reading through questions about sibling imports and even the
package documentation, but I've yet to find an answer.
With the following structure:
├── LICENSE.md
├── README.md
├── api
│ ├...
699
votes
23
answers
2.0m
views
How to install pip with Python 3?
I want to install pip. It should support Python 3, but it requires setuptools, which is available only for Python 2.
How can I install pip with Python 3?
252
votes
7
answers
148k
views
How to read a (static) file from inside a Python package?
Could you tell me how can I read a file that is inside my Python package?
My situation
A package that I load has a number of templates (text files used as strings) that I want to load from within ...
426
votes
5
answers
206k
views
Is __init__.py not required for packages in Python 3.3+
I am using Python 3.5.1. I read the document and the package section here: https://docs.python.org/3/tutorial/modules.html#packages
Now, I have the following structure:
/home/wujek/Playground/a/b/...
381
votes
6
answers
211k
views
What is the purpose of the -m switch?
Could you explain to me what the difference is between calling
python -m mymod1 mymod2.py args
and
python mymod1.py mymod2.py args
It seems in both cases mymod1.py is called and sys.argv is
['...
850
votes
10
answers
358k
views
What's the difference between a module and package in Python?
What's the difference between a module and package in Python?
See also: What's the difference between "package" and "module"? (for other languages)
595
votes
15
answers
708k
views
beyond top level package error in relative import [duplicate]
It seems there are already quite some questions here about relative import in python 3, but after going through many of them I still didn't find the answer for my issue.
so here is the question.
I ...
451
votes
35
answers
256k
views
Elegant way to check for missing packages and install them?
I seem to be sharing a lot of code with coauthors these days. Many of them are novice/intermediate R users and don't realize that they have to install packages they don't already have.
Is there an ...
107
votes
2
answers
250k
views
What does "The following object is masked from 'package:xxx'" mean?
When I load a package, I get a message stating that:
"The following object is masked from 'package:xxx'
For example, if I load testthat then assertive, I get the following:
library(testthat)
...
67
votes
4
answers
29k
views
Cannot install R-forge package using install.packages
This, question, is, asked, over, and, over, and, over,
on the R-sig-finance mailing list, but I do not think it has been asked on stackoverflow.
It goes like this:
Where can I obtain the latest ...
233
votes
10
answers
123k
views
NodeJS require a global module/package
I'm trying to install globally and then use forever and forever-monitor like this:
npm install -g forever forever-monitor
I see the usual output and also the operations that copy the files to the ...
438
votes
19
answers
1.1m
views
Relative imports - ModuleNotFoundError: No module named x
This is the first time I've really sat down and tried python 3, and seem to be failing miserably. I have the following two files:
test.py
config.py
config.py has a few functions defined in it as ...
3015
votes
32
answers
2.2m
views
Find the version of an installed npm package
How can I find the version of an installed Node.js or npm package?
This prints the version of npm itself:
npm -v <package-name>
This prints a cryptic error:
npm version <package-name>
...
66
votes
3
answers
34k
views
Is the use of Java's default package a bad practice?
Is the use of Java's default package a bad practice?
207
votes
3
answers
186k
views
Execution of Python code with -m option or not [duplicate]
The python interpreter has -m module option that "Runs library module module as a script".
With this python code a.py:
if __name__ == "__main__":
print __package__
print __name__
I tested ...
163
votes
5
answers
86k
views
How do I create a namespace package in Python?
In Python, a namespace package allows you to spread Python code among several projects. This is useful when you want to release related libraries as separate downloads. For example, with the ...
697
votes
4
answers
375k
views
What is a Python egg?
I'm trying to understand how Python packages work. Presumably eggs are some sort of packaging mechanism, but what would be a quick overview of what role they play and may be some information on why ...
679
votes
11
answers
571k
views
Installing a local module using npm?
I have a downloaded module repo, I want to install it locally, not globally in another directory?
What is an easy way to do this?
177
votes
12
answers
69k
views
Painless way to install a new version of R?
Andrew Gelman recently lamented the lack of an easy upgrade process for R (probably more relevant on Windows than Linux). Does anyone have a good trick for doing the upgrade, from installing the ...
129
votes
3
answers
210k
views
Python: importing a sub‑package or sub‑module
Having already use flat packages, I was not expecting the issue I encountered with nested packages. Here is…
Directory layout
dir
|
+-- test.py
|
+-- package
|
+-- __init__.py
|...
389
votes
16
answers
275k
views
How to install a private NPM module without my own registry?
I've taken some shared code and put it in an NPM module, one I don't want to upload to the central registry. The question is, how do I install it from other projects?
The obvious way is probably to ...
52
votes
4
answers
54k
views
How do I install a package that has been archived from CRAN?
I typed the following in the R command line:
install.packages("RecordLinkage")
I got the following error:
Warning in install.packages :
package ‘RecordLinkage’ is not available (for R version 3....
447
votes
24
answers
1.0m
views
Python 3: ImportError "No Module named Setuptools"
I'm having troubles with installing packages in Python 3.
I have always installed packages with setup.py install. But now, when I try to install the ansicolors package I get:
importerror "No ...
438
votes
16
answers
484k
views
How to get package name from anywhere?
I am aware of the availability of Context.getApplicationContext() and View.getContext(), through which I can actually call Context.getPackageName() to retrieve the package name of an application.
...
115
votes
3
answers
80k
views
Absolute vs. explicit relative import of Python module
I'm wondering about the preferred way to import packages in a Python application. I have a package structure like this:
project.app1.models
project.app1.views
project.app2.models
project.app1.views ...
34
votes
5
answers
30k
views
Create cross platform Java SWT Application
I have written a Java GUI using SWT. I package the application using an ANT script (fragment below).
<jar destfile="./build/jars/swtgui.jar" filesetmanifest="mergewithoutmain">
<manifest&...
949
votes
5
answers
470k
views
What is thread safe or non-thread safe in PHP?
I saw different binaries for PHP, like non-thread or thread safe?
What does this mean?
What is the difference between these packages?
207
votes
15
answers
537k
views
Can't import my own modules in Python
I'm having a hard time understanding how module importing works in Python (I've never done it in any other language before either).
Let's say I have:
myapp/__init__.py
myapp/myapp/myapp.py
myapp/...
102
votes
5
answers
70k
views
How include static files to setuptools - python package
I want to include the ./static/data.txt to setuptools, here is my code:
# setup.py
import os,glob
from setuptools import setup,find_packages
setup(
name = "PotatoProject",
version = "0.1.1",
...
782
votes
8
answers
578k
views
How can I specify the required Node.js version in package.json?
I have a Node.js project that requires Node version 12 or higher. Is there a way to specify this in the packages.json file, so that the installer will automatically check and inform the users if they ...
675
votes
12
answers
576k
views
How to unload a package without restarting R
I'd like to unload a package without having to restart R (mostly because restarting R as I try out different, conflicting packages is getting frustrating, but conceivably this could be used in a ...
717
votes
13
answers
553k
views
How do I remove packages installed with Python's easy_install?
Python's easy_install makes installing new packages extremely convenient. However, as far as I can tell, it doesn't implement the other common features of a dependency manager - listing and removing ...
43
votes
2
answers
107k
views
How to uninstall R and RStudio with all packages, settings and everything else?
I messed up something and there is a problem with tidyverse. Tried to find a solution but spend lots of time without result.
How to uninstall R and RStudio with all packages, settings and everything ...
2
votes
2
answers
6k
views
How to import members of all modules within a package?
I am developing a package that has a file structure similar to the following:
test.py
package/
__init__.py
foo_module.py
example_module.py
If I call import package in test.py, I want the ...
208
votes
9
answers
206k
views
How to use custom packages
I'm trying to create and use a custom package in Go. It's probably something very obvious but I cannot find much information about this. Basically, I have these two files in the same folder:
mylib.go
...
201
votes
12
answers
132k
views
how to install multiple versions of package using npm
Due to https://github.com/npm/npm/issues/2943, npm will never support the ability to alias packages and install multiple versions of the same package.
The workarounds posted on the github issue might ...
135
votes
7
answers
113k
views
List all the modules that are part of a python package?
Is there a straightforward way to find all the modules that are part of a python package? I've found this old discussion, which is not really conclusive, but I'd love to have a definite answer before ...
544
votes
6
answers
262k
views
What is the convention for word separator in Java package names?
How should one separate words in package names? Which of the following are correct?
com.stackoverflow.my_package (Snake Case using underscore)
com.stackoverflow.my-package (Kebab Case using hyphens)
...
281
votes
4
answers
334k
views
Where does R store packages?
The install.packages() function in R is the automatic unzipping utility that gets and install packages in R.
How do I find out what directory R has chosen to store packages?
How can I change the ...
156
votes
5
answers
62k
views
Java packages com and org
What are the meaning of the packages org and com in Java?
132
votes
16
answers
123k
views
How to change package name of Android Project in Eclipse?
I have an Android project created in Eclipse. I want to modify the package name and application of the project. How do I do that in Eclipse?
7
votes
2
answers
39k
views
Error: "there is no package called ..." and trying to use install.packages to solve it
The R studio I have in my university computer gives me an error when I try to download different packages, whereas when I'm with my laptop in the university server, I don't get this error. Because of ...
876
votes
10
answers
1.2m
views
Can I force pip to reinstall the current version?
I've come across situations where a current version of a package seems not to be working and requires reinstallation. But pip install -U won't touch a package that is already up-to-date. I see how to ...